- 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
2 ответов
+ 1
hi dear.
you must use different variables for checking out.
I create an example so can check it,
+ 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();