This abstract class allows subclasses to define sets of localized resources that can then be dynamically loaded as needed by internationalized programs. Such resources may include user-visible text and images that appear in an application, as well as more complex things such as Menu objects. Use getBundle( ) to load a ResourceBundle subclass that is appropriate for the default or specified locale. Use getObject( ), getString( ), and getStringArray( ) to look up a named resource in a bundle. To define a bundle, provide implementations of handleGetObject( ) and getKeys( ). It is often easier, however, to subclass ListResourceBundle or provide a Properties file that is used by PropertyResourceBundle. The name of any localized ResourceBundle class you define should include the locale language code, and, optionally, the locale country code.

public abstract class ResourceBundle {
// Public Constructors
     public ResourceBundle( );  
// Public Class Methods
     public static final ResourceBundle getBundle(String baseName);  
     public static final ResourceBundle getBundle(String baseName, Locale locale);  
1.2  public static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader loader);  
// Public Instance Methods
     public abstract Enumeration<String> getKeys( );  
1.2  public Locale getLocale( );  
     public final Object getObject(String key);  
     public final String getString(String key);  
     public final String[ ] getStringArray(String key);  
// Protected Instance Methods protected ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.