ResourceBundle.handleGetObject(String key) has the following syntax.
protected abstract Object handleGetObject(String key)
In the following code shows how to use ResourceBundle.handleGetObject(String key) method.
// w w w .j a v a 2 s . c o m import java.util.Enumeration; import java.util.Locale; import java.util.ResourceBundle; import java.util.StringTokenizer; class MainResourceBundle extends ResourceBundle { @Override public Object handleGetObject(String key) { if (key.equals("hello")) { return "Hello from java2s.com!"; } else { return null; } } @Override public Enumeration getKeys() { StringTokenizer key = new StringTokenizer("Hello from java2s.com!"); return key; } } public class Main{ public static void main(String[] args) { ResourceBundle bundle = MainResourceBundle.getBundle("hello", Locale.US); System.out.println(bundle.getString("hello")); } }