package readFile;
import java.util.Enumeration;
import java.util.ResourceBundle;
public class ReadPropFile
{
public static void main(String[] args)
{
ResourceBundle bundle = ResourceBundle.getBundle("MyProp");
//System.out.println(bundle.toString());
String email = bundle.getString("email");
String password = bundle.getString("password");
System.out.println("Email :: "+email);
System.out.println("Password :: "+password);
// Fetch all the Properties.
Enumeration keys = bundle.getKeys();
while(keys.hasMoreElements()){
System.out.println(keys.nextElement());
}
}
}
MyProp.properties 应该在 src 文件夹中
MyProp.properties 电子邮件 = 侯赛因密码 = 侯赛因