同目录下数据库配置文件读取
1,定义你的文件位置FileName="../DBConfig.property";
2,1.创建一个Properties对象
3,使用getclass()的getresourceasstream方法加载properties配置文件生成对应的输入流
4,2.使用properties的load对象加载文件的输入流
5,3.使用getProperty方法取值
6,流是否为空报错/关闭
public string getpara(string paraname){
filename="../DBConfig.propertise";
intputstream is=getclass().getresourceasstream()
propertise prop=new propertise();
prop.load(is);
prop.getproperty(paraname)
}//该方法返回值为配置文件中paraname所对应的值
(核心方法:1,创建一个Properties对象 2,使用对象的load方法加载你的property文件
3,使用getProperty方法取值)