Java Java Basics Getting Started with Java Strings, Variables, and Formatting

farai ted mandoreba
farai ted mandoreba
10,711 Points

Now replace <YOUR NAME> in the console.printf expression with the firstName variable using the string formatter.

i cant to get to give the required answer, what it that is required or considered correct, i have followed what the video tutorial teaches but its all wrong i'm stuck
// I have setup a object for you named console
String firstName = "farai";
console.printf ("%s , can code in java\n");
console.printf ("%s ,can code in java", firstName);

2 Answers

there is just string formatting problem...... thats how i did...

String firstName = "Godfrey";

console.printf("%s can code in Java!", firstName);
Tabatha Trahan
Tabatha Trahan
16,256 Points

It looks like if you get rid of your first printf function you should be good. It has the string formatter, but no string to populate it at the end of the expression. Your second printf looks like it is constructed correctly.

Emmanuel C
Emmanuel C
7,347 Points

Agreed, one thing to note is that the challenge is picky about the strings it wants you to display. So make sure you construct the sentence exactly how they want you to. Meaning itll want the exclamation at the end, Java should be capitalized and you can remove the comma.