Locale.getDefault() in Java

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

Syntax:

Locale java.util.Locale.getDefault()

This method returns the current value of the default locale for this instance of the Java Virtual Machine.

Returns: the default locale for this instance of the Java Virtual Machine.

Approach

Java

import java.util.Locale;

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

        System.out.println(Locale.getDefault());
    }
}

Output:

en_US

No comments:

Post a Comment