Originariamente inviata da el92 ma cosa vuol dire che "protegge" il nextLine()? Se si fa un test con hasNextInt() e se true poi un nextInt(), si è sicuri che quest'ultimo non lancerà InputMismatchException e nemmeno NoSuchElementException. Questa è la "garanzia" a cui mi riferivo prima.
Andrea, andbin.dev – Senior Java developer – SCJP 5 (91%) • SCWCD 5 (94%) java.util.function Interfaces Cheat Sheet — Java Versions Cheat Sheet
Regole del Forum