I have a code segment as below that uses BufferedReader to read inputs from command shell:
String choice = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("\nEnter choice: ");
choice = br.readLine();
In this case, assuming ‘3’ is my input, the console prints as follows:
Enter choice:
3
I would like to know how can I make the console prints such that it appears as follows:
Enter choice: 3
Appreciate any help!
Change
System.out.println("\nEnter choice ");to
System.out.print("\nEnter choice: ");(
printlnadds a line terminator at the end of the input string)