Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind Java Scanner reset() Method?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
// ___ a scanner object Scanner myObj = new Scanner("A string to scan");3Order
Put the learning moves in the order that makes the concept easiest to apply.
Reset changes made to the scanner's configuration:
Definition and Usage
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