这个方法是从properties文件中获取值
例如
host.name=smtp.qq.com
authen.name=1831428412@qq.com
authen.password=absqeliivtorbcde
charset=GBK
通过以下代码获取对应的值
static{
ResourceBundle bundle = ResourceBundle.getBundle("mail");
host = bundle.getString("mail.host");
charset = bundle.getString("mail.charset");
username = bundle.getString("mail.username");
password = bundle.getString("mail.password");
}
还可以进行国际化操作
详情请点击https://blog.csdn.net/qq_38975553/article/details/102935608