Java Scanner reset() Method

The reset() method of Java Scanner class is used to reset the Scanner which are in using. The resetting of scanner discards all of its explicit state information.

Syntax

Following is the declaration of reset() method:

Parameter

This method does not accept any parameter.

Returns

The reset() method reurns the Scanner which are in using.

Exceptions

NA

Compatibility Version

Java 1.6 and above

Example 1

Output:

1: is
2: a
3: JavaTpointThis
4: is
5: a
6: JavaTpoint

Example 2

Output:

Hello Java 10 + 10 = 20.0 false 
Default Radix: 10
en_IN