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

JavaTester.java uses or overrides a deprecated API.

always gets the problem says needed to recompile

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "Mark";
console.printf(fristName ,"can code in java");

2 Answers

Stuart Wright
Stuart Wright
41,118 Points

To fix this you need to:

  • correct the spelling of your variable name as you have a typo. Should be firstName, but you have fristName.
  • firstName should be joined to the second string using a + sign, rather than a comma.
  • the second string should begin with a space character, so that the final output has a space between your name and teh rest of the sentence.
foxtails
foxtails
3,655 Points

Your programming order is wrong (start with the quote, where you substitute String firstName with %s, when you are finish with the text, close quote and then put comma and write what %s is standing for - this time firstName) and you havent added %s for String in quotes, so the program doesn't understand what you want it to do. Start with quote "%s can code in java", then put firstName. Also as Stuart said you have a typo when you wrote variable firstName. Looks like this:

// I have setup a java.io.Console object for you named console
String firstName = "Mark";
console.printf("%s can code in Java!", firstName);