⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testmybundel.java

📁 程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件
💻 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 + -