Reputation: 481
Is there an Syntax that allows me to read the input from the user in the same line of the System.out.println() line
?
Example:
What is your name?:(<-- Output) Jack (<-- Input from user in the same line)
Upvotes: 1
Views: 305
Reputation: 62854
This should work for you.
System.out.print("What is your name?");
Upvotes: 4
Reputation: 20063
Use System.out.print
instead of println
Then your next input will be on the same line.
Upvotes: 6