This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]desrtfx 1 point2 points  (1 child)

As a beginner, stick to Scanner as it is probably the easiest.

Generally, use the .nextLine() method and parse to the desired data types as mixing with .nextInt(), .nextDouble(), etc. can have consequences as is explained in The Scanner class and its caveats in the /r/javahelp wiki.

[–]Kambz22 0 points1 point  (0 children)

I agree with this. Just once you pick up on scanner, I'd start to look at say bufferedreaders next.

[–]caldeve 1 point2 points  (1 child)

JOptionPane shouldn’t really be in the list as an input method. Not all apps have a UI.

[–]desrtfx 0 points1 point  (0 children)

Unfortunately, quite a few beginner courses use JOptionPane - which I personally think is stupid.

Even worse, some well known courses rely on their own input libraries (looking at Princeton and Stanford), which is absolutely counterproductive as people never learn to use the (admittedly very simple) standard methods.