user5544654
user5544654

Reputation:

Uses for Scanner() other than console

Reading through a lot of beginner tutorials and books I noted:

Scanner reader = new Scanner(System.in); 

Can be used to print something into the console and save whatever input the user types in. Does this have any other implementations other than when the user has access to the console of the IDE?

I know System.in is system input but what else can be placed in the Scanner method?

Upvotes: 0

Views: 52

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201487

Read the javadoc. You can construct a Scanner to read from a File, an InputStream, a Readable, a Path or a ReadableByteChannel.

Upvotes: 5

Related Questions