- 1

Can anyone tell me how to write a program that only show the second prompt after user input the first & press enter ?

I wrote a program which prompt the user to input 2 different values as input and hold them as 2 instances of Scanner. All is fine, except the console shown the 2 prompts on the screen at the same time, even though I wrote the Scanner(System.in ) line immediately after the System.out.println line

23rd Feb 2016, 1:34 AM
Lenny
2 Answers
+ 1
hi dear. you must use different variables for checking out. I create an example so can check it,
29th Mar 2016, 8:15 AM
ARS
ARS - avatar
+ 1
Here is some line. Suppose your having variable name int var1 and var2 and your scanner obj is sc System.out.println(" enter the input 1"); var 1 = sc.nextInt(); System.out.println(""); Var2 = sc.nextInt();
28th Apr 2016, 2:38 PM
kalpeshbhosale
kalpeshbhosale - avatar