读取配置文件 方式一

来源:互联网 发布:软件操作说明书模版 编辑:程序博客网 时间:2024/05/01 22:09
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);
         
         
    }
 
}
0 0
原创粉丝点击