使用ResourceBundle读取properties文件
作者:
你好小Song | 来源:发表于
2018-05-31 21:00 被阅读0次1.定义一个message.properties
name=jack
2.编写程序
package com.test;
import java.util.ResourceBundle;
public class TestDemo {
public static void main(String[] args) {
// 这里不需要写*.properies后缀,如果文件定义在包中,前面需要加上包名称,如com.tet.message
ResourceBundle res = ResourceBundle.getBundle("message");
String name = res.getString("name");
System.out.println(name);
}
}
本文标题:使用ResourceBundle读取properties文件
本文链接:https://www.haomeiwen.com/subject/akscsftx.html
网友评论