because when using the nextInt () it automatically jumps out of line in Java?

0

a little doubt in this code:

System.out.print("Digite el primer entero:");
  x = entrada.nextInt();
  System.out.print("Digite el segundo entero:");
  y = entrada.nextInt();

when you run out:

Digite el primer entero:4
Digite el segundo entero:6

My question is: should not I come out like this?:

Digite el primer entero:4Digite el segundo entero:6

since I am using System.out.print () and at no time am I indicating to the program that it should skip the line, how would it continue writing on the same line?

    
asked by Falricas 09.08.2018 в 23:27
source

1 answer

0

By default the nextInt () does a line break, since in this way confusion is avoided. Besides, if you take out the second print for example, it would seem that you are entering different digits for the same field.

    
answered by 11.08.2018 в 02:31