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