我有一个方法需要int[]
作为输入。从java属性文件中读取一个int []
methodABC(int[] nValue)
我想从Java属性文件
nValue=1,2,3
如何从配置文件读取这个还是我来存储这些不同的格式借此n值?
我想什么是(changing the nValue to 123 instead of 1,2,3
):
int nValue = Integer.parseInt(configuration.getProperty("nnValue"));
我们如何做到这一点?
不确定是否重复,但这可能对您有意思:http://stackoverflow.com/questions/7015491/better-way-to-represent-array-in-java-properties-file – Hexaholic
如果'nVAlueString = “1,2,3”;''你可以这样做:'nValueString.split(“,”);'然后解析结果数组。 – jrook