Properties示例

package map;

import java.io.FileInputStream;
import java.util.Properties;

/**
* @auto dh
* @create 2020-04-30-21:29
*/
public class Properties001 {
public static void main(String[] args) throws Exception {
// Properties里key、value都是字符串类型
Properties properties=new Properties();
// 加载流文件
properties.load(new FileInputStream("jdbc.properties"));
System.out.println(properties.getProperty("name"));
System.out.println(properties.getProperty("password"));
}
}
原文地址:https://www.cnblogs.com/kukai/p/12811284.html