Java Java Basics Perfecting the Prototype Looping until the value passes

atolagbe elijah
atolagbe elijah
Front End Web Development Techdegree Student 464 Points

printing response(lk a variable) in a string

please how can I print the response variable into the string of the last line console.printf,thanks
// I have initialized a for you. It is in a variable named console.
String response;
do{response=console.readLine("do you understand do while loops");}
console.printf("because you said No response ,you passed the test");

2 Answers

When using prinft you pass a formatString as the first parameter and any arguments to replace the placeholder characters in the formatString as the other parameters.

Something like this should work:

console.printf("Because you said %s, you passed the test!", response);