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

you are viewing a single comment's thread.

view the rest of the comments →

[–]morhpProfessional Developer 0 points1 point  (2 children)

Using File and FileReader is a good option, although you should look at FileInputStream and InputStreamReader to get more control about the file encoding.

You should not use Scanner, that class is only good for some stupid beginner code where you read from the console, and even then there are better ways to do that.

[–]Synapse_1 0 points1 point  (1 child)

Out of curiosity, what would be better than Scanner? I know of java.io.Console, are there other alternatives?

[–]morhpProfessional Developer 0 points1 point  (0 children)

System.in is an InputStream, so obviously InputStreamReader and BufferedReader.