Java代码中关于Properties的使用

Properties文件为本地资源文本文件,以“消息/消息文本”的格式存放数据。使用Properties对象时,首先需创建并实例化该对象,代码如下:

private static Properties prop = new Properties();

再通过文件输入流对象加载Properties文件,代码如下:

prop.load(new FileInputStream(propFileName));

最后通过Properties对象的getProperty()方法读取Properties文件中的数据。

猜你喜欢

转载自blog.csdn.net/weixin_44182586/article/details/100898989