VOOZH about

URL: https://www.geeksforgeeks.org/java/scanner-reset-method-in-java-with-examples/

⇱ Scanner reset() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scanner reset() method in Java with Examples

Last Updated : 11 Jul, 2025
The reset() method of java.util.Scanner class resets this scanner. On resetting a scanner, it discards all of its explicit state information which may have been changed by invocations of useDelimiter(java.util.regex.Pattern), useLocale(java.util.Locale), or useRadix(int). Syntax:
public Scanner reset()
Return Value: This function returns this scanner which has been reset. Below programs illustrate the above function: Program 1:
Output:
Scanner String:
Geeksforgeeks has Scanner Class Methods

Before Reset:

Radix: 30
Locale: en_US

After Reset:

Radix: 10
Locale: en_US
Program 2:
Output:
Scanner String:
Geeksforgeeks

Before Reset:

Radix: 12
Locale: en_US

After Reset:

Radix: 10
Locale: en_US
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#reset()
Comment