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

Define a string variable named FirstName that stored your name

Is giving an error on import java.io.console; The errors were on import and .console

Name.java
// I have setup a java.io.Console object for you named consol
import java.io.console;
class Name{
  public static void main(String [] args){
    console console = console.system();
    String FirstName = "Samaila";
    console.printf("%s is learning java at treehouse FirstName");
    console.printf("Learning java is nice at treehouse says %s FirstName");
  }
}

2 Answers

Benjamin Lange
Benjamin Lange
16,177 Points

Java is case sensitive. It looks like you need to capitalize the Console in your import statement. You will also need to capitalize the first Console in your main function.

andren
andren
28,521 Points

While everything Benjamin Lange says is true, the capitalization of Console is not the main issue with your solution.

When doing Java challenges on Treehouse you rarely need to include a lot of boilerplate code. Creating the main method and importing the console and everything else like that is done for you automatically. You only need to type the exact code the challenge asks for.

Since the challenge asks you to declare a string variable, that is the only line of code you need to type, nothing else.

Challenges are also very picky about naming. Since they ask you to name the variable firstName it has to be named exactly that, down to the capitalization used. Like this:

String firstName = "Samaila";

The above code is the only line of code needed to pass the first task of this challenge.