ResourceBundle getLocale() in Java

getLocale(): This method is available in java.util.ResourceBundle class of Java.

Syntax:

Locale java.util.ResourceBundle.getLocale()

This method returns the locale of this resource bundle.

Parameters: NA

Returns: the locale of this resource bundle.

Exceptions: NA

Approach

Java

import java.util.Locale;
import java.util.ResourceBundle;

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

        ResourceBundle bundle =
ResourceBundle.getBundle("Hello", Locale.US);
        System.out.println(bundle.getLocale());
    }
}

Output:

en_US


No comments:

Post a Comment