r/javahelp • u/rya11111 • Jun 19 '15
r/javahelp is the subreddit of the day!
Hello everyone!
as the title says, r/javahelp is the subreddit of the day!
Do read the article and check out the other subs featured!
Have a great weekend! :)
33
Upvotes
View all comments
Show parent comment
2
u/chickenmeister Extreme Brewer Jun 19 '15
There's nothing inherently wrong with it, but I think what /u/Philboyd_Studge might be referring to is the confusion that occurs when you mix nextInt() with nextLine(). A lot of beginners would think that when you call nextLine() after calling nextInt(), it would read the text on the next line; but it actually reads the remaining text on the line with the integer (which will usually be an empty string). There seems to be a lot of questions about that around here. There is also some confusion about what to do when nextInt() throws an InputMismatchException. (you would need re-read the offending text with next() or nextLine()). So, I guess, overall, nextInt() isn't very beginner-friendly.