读properties文件

public class TestProperties {
	public static void main(String[] args) throws IOException {
		Properties p=new Properties();
		InputStream is=new FileInputStream(".\\TestConfig\\config.properties");
		p.load(is);
		
		String name=p.getProperty("name");
		String url=p.getProperty("url");
		System.out.println(name);
		System.out.println(url);
		
		is.close();
	}
}

猜你喜欢

转载自blog.csdn.net/weixin_39218743/article/details/86700006