Java API Tutorial - Java ResourceBundle.getLocale()








Syntax

ResourceBundle.getLocale() has the following syntax.

public Locale getLocale()

Example

In the following code shows how to use ResourceBundle.getLocale() method.

//from   w w  w  . j  av  a 2  s  . c  om
import java.util.Locale;
import java.util.ResourceBundle;

public class Main {

   public static void main(String[] args) {

      ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US);

      System.out.println(bundle.getString("hello"));

      System.out.println(bundle.getLocale().toString());

   }
}