“Insanity is doing the same thing over and over again and expecting different results.” -> Albert Einstein I kept running into a strange issue in Java where scanner.nextLine() seemed to be skipped ...
🚨 𝐉𝐚𝐯𝐚 𝐒𝐜𝐚𝐧𝐧𝐞𝐫 𝐆𝐨𝐭𝐜𝐡𝐚! Ever noticed how nextLine() gets skipped after using nextInt()? Here's why: When you call nextInt(), Java reads the number but leaves the newline (\n) in the ...
Fixed the comment to say that 0 is the issue, not a negative number. nextInt doesn't allow 0 to be passed, and since the filtered stream above yields 0 elements, this seems to cause the crash.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results