【发布时间】:2012-05-24 07:32:15
【问题描述】:
我在我的 java 程序中使用属性文件。
目前,每当我需要属性文件中的某些属性时,我都会使用propertyFile.getProperty(propertyKeyName);并将其放入某个变量中:String propertyName1 = propertyFile.getProperty(propertyKeyName);
如果没有明确定义变量 (propertyName1) 并使用 getProperty() 对其进行初始化,有什么方法可以将属性文件的所有 Key=Value 作为已初始化的字符串变量“字符串键” =Value”在我的程序中?
谢谢, 钱德拉
【问题讨论】:
-
您能给我们看一个您期望的例子吗?
-
你看过java中的docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html。它接受输入流并将所有属性加载为字符串
标签: java properties getproperties