Java ResourceBundle .getBundle (String baseName, Locale targetLocale, ClassLoader loader, ResourceBundle .Control control)
Syntax
ResourceBundle.getBundle(String baseName, Locale targetLocale, ClassLoader loader, ResourceBundle.Control control) has the following syntax.
public static ResourceBundle getBundle(String baseName, Locale targetLocale, ClassLoader loader, ResourceBundle.Control control)
Example
In the following code shows how to use ResourceBundle.getBundle(String baseName, Locale targetLocale, ClassLoader loader, ResourceBundle.Control control) method.
/*from w ww . j ava 2 s . com*/
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.ResourceBundle.Control;
public class Main {
public static void main(String[] args) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
ResourceBundle.Control rbc = ResourceBundle.Control.getControl(Control.FORMAT_DEFAULT);
ResourceBundle bundle = ResourceBundle.getBundle("hello", Locale.US, cl, rbc);
System.out.println(bundle.getString("hello"));
}
}
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »