Locale hasExtensions() in Java

hasExtensions(): This method is available in java.util.Locale class of Java.

Syntax:

boolean java.util.Locale.hasExtensions()

This method returns true if this Locale has any extensions.

Returns: true if this Locale has any extensions.

For Example:

Locale locale = new Locale("en", "USA", "US")

locale.hasExtensions() = > It returns false.

Approach

Java

import java.util.Locale;

public class LocalehasExtensions {
    public static void main(String[] args) {

        Locale locale = new Locale("en""USA""US");

        System.out.println(locale.hasExtensions());
    }
}

Output:

false

No comments:

Post a Comment