My code output is like this:
"Please enter your name: "
_ <-
How do I make my code like this:
"Please enter your name: _ <-"
this my code
import java.util.Scanner;
public class input {
public static void main(String[] args) {
System.out.println("Please enter your name: ");
Scanner Input = new Scanner(System.in);
String inp = Input.nextLine();
}
}
>Solution :
Check your line System.out.println("Please enter your name: ").
Here, println adds a new line \n after the print statement.
To avoid adding a new line, replace println with print.