JAVA 读取配置文件properties
//读取配置文件获取name InputStream inputStream = new FileInputStream("config.properties"); Properties properties = new Properties(); properties.load(inputStream);
String name = properties.getProperty("name")
新建一个配置文件:config.properties,放在项目得根目录,如果放在其他位置则会出现“系统找不到文件”错误。


浙公网安备 33010602011771号