Java.util.ListResourceBundle.getKeys() 方法 Java.util.ListResourceBundle.getContents() 方法 Java.util.ListResourceBundle.handleGetObject() 方法 Java.util.ListResourceBundle.getKeys() 方法 package com.codingdict; import java.util.*; // create a class that extends to ListResourceBundle class MyResources extends ListResourceBundle { // get contents must be implemented protected Object[][] getContents() { return new Object[][] { {"hello", "Hello World!"}, {"bye", "Goodbye World!"}, {"goodnight", "Goodnight World!"} }; } } public class ListResourceBundleDemo { public static void main(String[] args) { // create a new MyResources instance MyResources mr = new MyResources(); // get the keys Enumeration<String> enumeration = mr.getKeys(); // print the keys while (enumeration.hasMoreElements()) { System.out.println("" + enumeration.nextElement()); } } } Java.util.ListResourceBundle.getContents() 方法 Java.util.ListResourceBundle.handleGetObject() 方法