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 trialTheone Instructor
65 Pointswhat to do for illegal start of expression public?
I have declared illegal start expression to the class.
// I have setup a java.io.Console object for you named deepa
public class Name {
public static void main(String[] args){
Console console= System.console();
String firstName="Deepa";
console.printf("The first name is " +firstName);
}
}
3 Answers
Livia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsYou don't need to create a class and a main method. In this challenge, just write the lines that go inside the main method. As it says in the comments, you also shouldn't create a console object. There is already one and you can just use it.
For the first task just write the variable declaration. It should be a single line of code.
Task 2 should be a second line of code, which you then should change slightly for the third task. At no point should you have more than two lines of code. Just follow the instructions exactly and you'll be fine.
Carl Lamb
Courses Plus Student 457 Pointsso how is it supposed to be and what is supposed to start
Livia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsI just told you, just write the declaration of the firtName variable.
Carl Lamb
Courses Plus Student 457 Pointsthats the error i get when i do that
JavaTester.java:73: error: cannot find symbol string firstName="carl"; ^ symbol: class string location: class JavaTester Note: JavaTester.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
Livia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsI answered that in your second question, it's because it must be String with an uppercase S. Java is case sensitive so for the compiler 'String' and 'string' are two different things.