19
Lo scanner salta nextLine () dopo aver usato next () o nextFoo ()?
Sto usando i Scannermetodi nextInt()e nextLine()per leggere l'input. Sembra così: System.out.println("Enter numerical value"); int option; option = input.nextInt(); // Read numerical value from input System.out.println("Enter 1st string"); String string1 = input.nextLine(); // Read 1st string (this is skipped) System.out.println("Enter 2nd string"); String string2 = input.nextLine(); // Read 2nd string (this …
684
java
io
java.util.scanner