Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Basics Getting Started with Java Strings and Variables

JavaTester.java:73: error: illegal start of expression public class Name{ ^ 1 error

always get this error,Anyone can help me how to solve this..? https://prnt.sc/j5ytey , that is a link to the code i wrote.

1 Answer

Don't write the class and main method, just write the lines that go inside the main method. Do not create the Console object, there is already one.

Just write what goes inside the main method, without the creation of the console object. In your code snippet that would be lines 4, 5, and 6.

Other points to note in order to avoid other errors as well:

  • Write "console" with a lowercase c
  • You should only need one "console.printf()" line, not two
  • Don't forget to pass the firstName variable in the printf method for task 3

Thanks you :)