the nextLine() reads the line separator ("\n") left behind by the nextInt() method. And since there is no String before the "\n" it just assigns the empty String to the tans variable.Since this method continues to search through the input looking for a line separator
Harsha Smith wrote: TimeUnit.SECONDS.sleep(5);
Why “guess”? That is obviously correct.John Jai wrote:My guess . . .
Deepak Rajendran wrote: usually when we get inputs using sc.nextLine() we have to give enter 2 times.
Deepak Rajendran wrote:and this time also 2 enter only works