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

console.printf("First name: %s", firstName); this dont work for me

console.printf("First name: %s", firstName); this dont work for me

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "asd";
console.printf("First name: %s", firstName);

1 Answer

Steven Parker
Steven Parker
176,634 Points

The challenge instructions say to make it write out "<YOUR NAME> can code in Java!"

But this code will write out "First name: <YOUR NAME>" instead. The variable substitution is good, so just fix the template string to write out what the challenge expects and you'll pass.