bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java Scanner reset() Method

❮ Scanner Methods

Example

Reset changes made to the scanner's configuration:

// Create a scanner object Scanner myObj = new Scanner("A string to scan");
// Change configuration myObj.useDelimiter(","); myObj.useLocale(new Locale("es")); myObj.useRadix(16);
// Reset the configuration myObj.reset();
// Read configuration values System.out.println(myObj.delimiter()); System.out.println(myObj.locale()); System.out.println(myObj.radix());

Definition and Usage

The reset() method resets all changes to the scanner's configuration. Configuration of the scanner can be changed by the useDelimiter() , useLocale() and useRadix() methods.

Syntax

public Scanner reset()

Technical Details

Returns:A reference to the Scanner object that this method belongs to, which allows for chaining configuration methods. An example of chaining is myObj.reset().useDelimiter(","); .
Java version:1.6+

❮ Scanner Methods

Previous

Java Scanner radix() Method

Next

Java Scanner useDelimiter() Method