Skip to content
Advertisement

What is the Scanner class used for in Java? [closed]

In Java, what is the Scanner class used for?

Advertisement

Answer

See the Javadoc:

A simple text scanner which can parse primitive types and strings using regular expressions.

Basically, you can initialize a Scanner with some input stream and a format or delimiter, then use it to iterate over “tokens” (broken-up chunks of text) that it generates from that input stream with the delimiter info you give it.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement