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

keeps giving me a compiler error what to do???

compiler error.restructure syntax...dont know what to do???

Name.java
// I have setup a java.io.Console obsject for you named console
string FirstName="Sid";
console.printf("My name is %s"FirstName);
console.printf("%s is completing a java assignment"FirstName);

1 Answer

Brendon Butler
Brendon Butler
4,254 Points

First off "string" should be capitalized. And variable names should be camelcase.

string FirstName = "Sid";
// should be
String firstName = "Sid";

When you call the printf() function, it takes multiple variables, you would separate them with a comma

console.printf("My name is %s", firstName);