This method resets this scanner.Resetting a scanner 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:Library: java.util.Scanner
public Scanner reset()
Example:import java.util.*;
public class ScannerDemo {
public static void main(String[] args) {
String s = "Hello World! 3 + 3.0 = 6.0 true ";
// create a new scanner with the specified String Object
Scanner scanner = new Scanner(s);
// print a line of the scanner
System.out.println("" + scanner.nextLine());
// change the locale of this scanner
scanner.useLocale(Locale.US);
// change the radix of this scanner
scanner.useRadix(30);
// reset and check the values for radix and locale, which are the default
scanner.reset();
System.out.println("" + scanner.radix());
System.out.println("" + scanner.locale());
// close the scanner
scanner.close();
}
}
Output:
Hello World! 3 + 3.0 = 6.0 true
10
el_GR
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 224 / 158776527. Delta: 0.00932 с