Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHarsh Agarwal
Courses Plus Student 622 PointsWhat is the problem in the code ?
My code is as follows
//workSpace1.java
public class WhoIs{ private String mCharacterName="Harsh";
public String getName() { return mCharacterName; } }
//Example.java public class Example {
public static void main(String[] args) {
WhoIs name = new WhoIs();
System.out.println("My name is %s", name.getName());
}
}
The compiler is giving the error couldn't find the symbol symbol: class WhoIs location: class Example
3 Answers
pinar
2,329 PointsHey The problem is that you need to use printf instead of println. Printf can take a formatted string but println can take just a single string(unformatted) and prints it out
Deividas Strioga
12,851 PointsHey, the name of the file has to be the same as the name of your class. If you want to name your class WhoIs, then your file has to be named WhoIs.java
osman musse
100 PointsYeah nice point