Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles. This allows you to write programs that can: be easily localized, or translated, into different languages 
handle multiple locales at once 
be easily modified later to support even more locales

解决方案 »

  1.   

    好像只是定義一個.properties文件,集合所有調用的資料,如String等等
      

  2.   

    主要用于多语言支持,例如你有两个properties文件:
    aaa_en.properties   aaa_zh_CN.properties 放在classpath下的目录ccc中,则在应用程序中如果如下使用:
    ResourceBundle resources;
    res = ResourceBundle.getBundle("ccc.aaa",Locale.getDefault());在aaa_en.properties中有 NOTFOUND=not found在aaa_zh_CN.properties中有 NOTFOUND=未发现则res.getString("NOTFOUND") 的结果如下:
    如果你的系统缺省区域设置为中文,则返回字符串“未发现”
    如果你的系统缺省区域设置为英文,则返回字符串“not found”关键在于properties文件的命名,中文为*_zn_CN.properties, 英文为*_en.properties,其他国家的命名方法请查找资料
      

  3.   

    当然,还有其他好处,例如提示及显示信息的集中管理,如果想改变信息,直接更改peoperties文件内容即可,而不用更改程序