Java Locale equals() methodThe equals() method of Java Locale class returns true if this Locale is equal to another object. A Locale is deemed equal to another Locale with identical language, variant, country, extension, script, and unequal to all other objects. SyntaxParameterobj: It is the reference object with which to compare. ReturnIt returns the default locale for this instance of Java Virtual Machine Example 1Test it NowOutput: Locale1: company_JAVATPOINT Locales are equal: false Example 2Test it NowOutput: Locale1: company_JAVATPOINT Locale2: owner_SONOO Locale1 and Locale2 are equal: false Locale2 and Locale3 are equal: true Example 3Test it NowOutput: Locale1: company_JAVATPOINT Locale2: owner_SONOO Locale2 and Locale3 are equal: true Locale1 and Locale4 are equal: true
Next TopicJava Locale
|