package properties;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
//属性类加载资源文件
public class PropertiesDemo {
public static void main(String[] args) throws Exception {
Properties p =new Properties();
FileInputStream in = new FileInputStream(new File("D:/workspcae/listAllFiles/process/hello.properties"));
p.load(in);
System.out.println(p);
System.out.println(p.getProperty("name"));
System.out.println(p.getProperty("password"));
in.close();
}
}
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
//属性类加载资源文件
public class PropertiesDemo {
public static void main(String[] args) throws Exception {
Properties p =new Properties();
FileInputStream in = new FileInputStream(new File("D:/workspcae/listAllFiles/process/hello.properties"));
p.load(in);
System.out.println(p);
System.out.println(p.getProperty("name"));
System.out.println(p.getProperty("password"));
in.close();
}
}