bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java Scanner locale() Method

❮ Scanner Methods

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.

❮ Scanner Methods

Previous

Java Scanner hasNextShort() Method

Next

Java Scanner next() Method