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

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,178 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,558 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.