java.util.ListResourceBundle.getKeys() の使い方
Javaコード
package ListResourceBundle;
import java.util.Enumeration;
import java.util.ListResourceBundle;
//create a class that extends to ListResourceBundle
class CftResourcesKz extends ListResourceBundle {
// get contents must be implemented
protected Object[][] getContents() {
return new Object[][]{
{“Java", “java test!"},
{“php", “php test"},
{“python", “python test"}
};
}
}
public class ListResourceBundlegetKeysDemo {
public static void main(String[] args) {
// create a new CftResourcesKz instance
CftResourcesKz mr = new CftResourcesKz();
// get the keys
Enumeration enumeration = mr.getKeys();
// print the keys
while (enumeration.hasMoreElements()) {
System.out.println(“" + enumeration.nextElement());
}
}
}
実行結果
Java
php
python