Java Java Basics Getting Started with Java Strings and Variables error: illegal start of expression public class Name{ ^ 1 error

always get this error,Anyone can help me how to solve this..? , that is a link to the code i wrote.

1 Answer

Livia Galeazzi
Livia Galeazzi
Java Web Development Techdegree Graduate 19,904 Points

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