username=username;
password=password;
phone=phone;
submit=submit;
myresource_zh.properties:
username=\u7528\u6237\u540D
password=\u5BC6\u7801
phone=\u7535\u8bdd
submit=\u786E\u5B9A
myresource_en.properties:
username=username;
password=password;
phone=phone;
submit=submit;
entry.java:
package com.csdn.hbsi.test;
import java.util.Locale;
import java.util.ResourceBundle;
public class entry{
/**
* @param args
*/
public static void main(String[] args) {
ResourceBundle bundle = ResourceBundle.getBundle(
"com.csdn.hbsi.myresource", Locale.ENGLISH);// 获取resourcebundle对象(包括指定资源文件名和)
String u = bundle.getString("username");// 把资源文件中的username变量对应的值拿过来。
String p = bundle.getString("password");// 把资源文件中password变量对应的值拿过来
String h = bundle.getString("phone");
System.out.println(u);
System.out.println(p);
System.out.println(h);
}
}