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

it keeps telling me there is a compiler error when it is asking me to define string firstname set value equal to your nm

string firstname = "joey"; ????

Name.java
string firstname = "joey";

console.printf (my name is %s)

3 Answers

Hi there,

You're pretty much there with just a couple of tweaks. You'll need to have String with a capital S and the N in name should be capitalised too, as is convention:

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

I also amended your printf method for the second/third part of the challenge.

Steve.

Mikkel Rasmussen
Mikkel Rasmussen
31,772 Points

You are missing serveral things:

  1. Your variable type (string) need to start with a big S.
  2. Change variable to firstName with big N to make it easier to read.
  3. the printf you need to add "%s can code in Java!" and after make a comma and add the firstname.
  4. end the printf with a semicolon.
          String firstName = "joey";
          console.printf ("%s can code in Java!", firstName);

String firstName = ''joey"; console.printf ("my name is %s",firstName)