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, Variables, and Formatting

JavaTester.java:74: error: illegal start of expression public class Introductions

i have followed the instruction but still got error. this is my first time learn language program. could you tell me what should i do first ?

Name.java
// I have setup a java.io.Console object for you named console

public class Introductions {
public static void main (String[] args){
  Console console = System.console();
  //this is introduction program!
  String firstName = "Ade";
  //thisIsCamelCasing
  console.printf("Hello, my name is Ade \n", firstName);
  console.printf("Ade is learning Java Language Program \n", firstName);
}
}

Still having the same error message

3 Answers

Olha Markova
Olha Markova
2,050 Points

Make sure, that you write all the words without mistakes and don´t forget semikolons etc. If you used copy/paste it can also lead to the error. Try to delate your code and type it again

Olha Markova
Olha Markova
2,050 Points

Hi Ade! Your Problem is, that you forgot to use "%s" instead of "Ade" in both lines console.printf. It means, that you have stored your name ("Ade") in variable firstName, that is why you don´t actually need to type it again istead of it you use "%s". Here is the code:

public class name {

    // I have setup a java.io.Console object for you named console

    public static void main (String[] args){
        //this is introduction program!
        String firstName = "Ade";
        //thisIsCamelCasing
        System.out.printf("Hello, my name is %s \n", firstName);
        System.out.printf("%s is learning Java Language Program \n", firstName);
    }
}

You don't need to create class, Just enter your statement, your code Directly