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

Jade Hudson
Jade Hudson
6,859 Points

I don't understand what I'm doing wrong here. Getting a console syntax error.

What is this console syntax error coming from.

String firstName = "Jade"; console.printf = ("%s can code in Java!", firstName);

I'm utterly new to Java, so please go easy on me :)

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

2 Answers

Gavin Ralston
Gavin Ralston
28,770 Points
String firstName = "Jade";  // this is a variable so it needs an assignment (the = sign)
console.printf = ("%s can code in Java!", firstName);  // this is a method, and does NOT use the = sign!

So methods just have those parenthesis attached right to them. They're the basket for extra information to be passed into it as needed.

object.doThing(optionalStuff); That's how you'd do it.

String firstName = "Jade";  
console.printf("%s can code in Java!", firstName);  // That should do it!
Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hi Jade,

delete the = sign and you will be fine :)