Java Scanner locale() Method
Example
Show the locale that is currently being used by the scanner:
// Create a scanner object
Scanner myObj = new Scanner("A string to scan");
// Find the locale
System.out.println(myObj.locale());
Definition and Usage
The locale()
method returns a Locale
object describing the locale used when interpreting numbers. The locale specifies formatting such as which character is used as a decimal point and how digits in large numbers are grouped.
Syntax
public Locale locale()
Technical Details
Returns: | A Locale object describing the locale used by the scanner. |
---|