ofek Lalkin2,680 Points
task 3of io
// I have imported java.io.Console for you. It is a variable called console. String firstName= console.readLine("My Name Is Ofek"); String lastName= console.readLine("My Name Is Lalkin"); console.printf(" first Name"); console.printf("first Name is %S",firstName);
Rich Zimmerman24,052 Points
The console.readLine() method will take input from the user in the command line. It looks like the way you're trying to use it is as if it's reading "My Name is Ofek", but that is not correct. the readLine method print out whatever is in the quotes and then store the user's input in the variable to be used.
String firstName = console.readLine("What is your first name? ");
This will print "What is your first name? " to the console, at which point you can type "Ofek". Then when you reference the variable 'firstName', is has the value of "Ofek".
Another possible error - in your printf() you've got "%S", should be a lower case s.
console.printf("first Name is %s", firstName);