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 trialALI RAZA
183 PointsI don't know what's wrong with code.....plzzz help me
please give me correct code and instructions
// I have setup a java.io.Console object for you named console
public class Name{
public static void main(string[]args){
Console console=System.console
String FirstName="ALII";
console.printf("ALII knows how to handle\n");
console.printf("%s is learning to write java\n");
}
3 Answers
Justin Blackwell
6,675 PointsWhat error are you getting? And what is the question?
At first glance, your second printf has %s in it but you are not specifying what string it should be. Below is the correct syntax for making FirstName appear where the %s inside of the string.
console.printf("%s is learning to write java\n", FirstName);
All parameters need to be comma separated at the end of the function call. For example:
console.printf("%s is learning to write %s\n", FirstName, "java");
ALI RAZA
183 Pointsok
John Paige
7,436 PointsHey there, you really just need a couple lines to pass this challenge. The first line is to store your name in a String, and the second line uses console.printf.