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

Nkosinolwazi Moyo
Nkosinolwazi Moyo
2,157 Points

String formatter

Can proceed

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "nkosi";
console.printf ("hello, my name is nkosi\n");
console.printf ("nkosi can code in Java\n", firstName );

1 Answer

Jainesh Patel
Jainesh Patel
11,087 Points

You should try console.printf("Hello my name is %s %n", firstName); The %s is used for when you want to use variables. In this case firstName