Java Locale toString() method

The toString() method of Locale class is used to return a string representation of this Locale object, consisting of language, country, variant, script, and extensions.

Syntax

Parameter

NA

Return

This method returns a string representation of the Locale, for debugging.

Example 1

Output:

Locale1 name: english_US_WIN
String representation of Locale1: english_IN_IND

Example 2

Output:

Locale1 name: english_US_WIN
String representation of Locale1: english_US_WIN
Locale2: fr_FRANCE_WIN
String representation of Locale2: fr_FRANCE_WIN

Next TopicJava-system