我正在尝试从属性文件加载信息,并且我有以下代码:
anInt = Integer.parseInt(prop.getProperty("anInt"));
aDouble = Double.parseDouble(prop.getProperty("aDouble"));
虽然第一行工作得很好,但我试图加载双变量的第二行会抛出一个NumberFormatException
. 具体的异常信息是:
Exception in thread "main" java.lang.NumberFormatException: For input string: "78,5"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
at java.lang.Double.parseDouble(Double.java:510)
at Assignment1.BaseStation.readPropertyFile(BaseStation.java:59)
at Assignment1.BaseStation.main(BaseStation.java:83)