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

Min ..
Min ..
648 Points

I am so sorry, I tried several times but my answer turns out "Bummer!" What does this task ask me to do?

I am so sorry, I tried several times but my answer turns out "Bummer!" What does this task ask me to do? I made this string, "string firstName = "Min"; I am sure that this work is correct. I don't know what 'a compiler error' means. What do I need to add ? I appreciate it.

Name.java
// I have setup a java.io.Console object for you named consoles
string firstName = "Min" ;

2 Answers

Loris D'Antonio
PLUS
Loris D'Antonio
Courses Plus Student 10,155 Points

Hello Min,

Pay attention to the variable type you are declaring, its case sensitive.

In fact, string does not exist, String does

String firstName = "Min" ;
Min ..
Min ..
648 Points

Oh I see. But one more question. When I type "console.printf" , It didn't matter if I started with lowercase. But in case of "String", does it matter? Because string does not exist? Is it explained just like that? Thanks in advance!

Loris D'Antonio
Loris D'Antonio
Courses Plus Student 10,155 Points

When I type "console.printf" , It didn't matter if I started with lowercase

it matters, depends how you have declared your console object, remember that is java is case sensitive.

The following code will work:

Console console; //declaration, your Console object is named console
console = System.console(); //definition
console.printf("Hello !");

Console (upper case C) - is the class

console - is the name you are giving to your object.

so, to use properly your object, the syntax is:

<object_name>.<method>
console.printf()

this instead, will not work:

Console objConsole; //declaration
objConsole = System.console(); //definition
objconsole.printf("Hello !"); // ERROR: we are trying to use objconsole, but does not exist ! (c should be UpperCase)
Min ..
Min ..
648 Points

You are so perfect