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 trial

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 :)