How to write a text on the same line with the entered command before pressing the return-key? I have a switch statement where I choose one command, in this case to write some text after I enter in command "message". It should look like this:
Command> message This is the message!
But instead of that, it looks like this:
Command> message
This is the message!
My code:
switch (choice) {
//other commands
case "message":
printMessage();
break;
default:
System.out.println("Error, invalid input!");
}
public void printMessage() {
String message = scan.nextLine();
}
Please be merciful, I'm a complete beginner :)