1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package properties;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
*@version 2015年4月26日 下午1:18:34
*@author sky
*读取配置文件 方式一:(不推荐)
*/
public class Properties02 {
public static void main(String[] args) throws FileNotFoundException, IOException {
//读取配置文件(前提是配置文件已经存在)
Properties prop =
new
Properties();
prop.load(
new
FileInputStream(
"bin/db.properties"
));
String driStr=prop.getProperty(
"driver"
);
System.out.println(driStr);
}
}
|
读取配置文件 方式一
最新推荐文章于 2020-11-22 16:44:01 发布