📄 testmybundel.java
字号:
package examples.i18n;
import java.util.ResourceBundle;
import java.util.Enumeration;
import java.util.Locale;
public class TestMyBundle {
/** Test method for the class
* @param args not used
*/
public static void main( String[] args ) {
ResourceBundle rb;
String bundleName = "examples.i18n.MyBundle";
rb = ResourceBundle.getBundle( bundleName,
Locale.CANADA );
print( "CANADA Locale:", rb );
}
/** Print the contents of a resource file
* @param label the label given to the output
* @param rb the ResourceBundle object to print
*/
public static void print( String label,
ResourceBundle rb ) {
System.out.println( label );
Enumeration e = rb.getKeys();
String key;
while( e.hasMoreElements() ) {
key = (String) e.nextElement();
System.out.println( "\t" + key + " = "
+ rb.getObject( key ) );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -