Stats

192 Contributors: 9 Tuesday, August 1, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap
Download eBook

Scanner

Download java eBook

Syntax

  • Scanner scanner = new Scanner(Source source);
  • Scanner scanner = new Scanner(System.in);

Parameters

ParameterDetails
SourceSource could be either one of String, File or any kind of InputStream

Remarks

The Scanner class was introduced in Java 5. The reset() method was added in Java 6, and a couple of new constructors were added in Java 7 for interoperability with the (then) new Path interface.

Related Examples