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!

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 IO

illegal start of expression

Hi , For the class public i am getting illegal start of expression error

// I have imported java.io.Console for you.  It is a variable called console
private class Introducton

   public static void main(String[]args)
    console cons=System.cons();
    String firstname=cons.readLine("what is your name? ");
    cons.printf("Hello ,My name is  %S\n", firstname);


2 Answers

james south
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

you don't need to make a class or a main here, the autograder will take care of that. this is a one-line solution. just create the variable like it asks and keep in mind it already has a Console for you called console.

Presley Cobb
Presley Cobb
971 Points

You don't need to redefine the console variable. Just use console. also use lowercase %s.