Javatpoint Logo
Javatpoint Logo

Java Scanner useLocale() Method

The useLocale() method of Java Scanner class is used to sets this scanner's locale object to the specified locale.

Syntax

Following is the declaration of useLocale() method:

Parameter

Parameter Description Required/Optional
locale It is a string which specifying the locale to use. Required

Returns

The useLocale() method returns this scanner's locale object.

Exceptions

NA

Compatibility Version

Java 1.5 and above

Example 1

Output:

Hello JavaTpoint! 12 + 13.0 = 25 
New Locale: en

Example 2

Output:

The delimiter used is: /
JavaTpoint
Abhishek
Male
22
Next TopicJava Scanner Class


Help Others, Please Share

facebook twitter pinterest