黑马程序员 Properties存取配置文件
上一篇 /
下一篇 2014-07-06 22:11:43
/ 个人分类:java知识
Properties:根据它的键、值存取配置文件。
import java.io.*;
import java.util.*;
import java.text.*;
class Propertydemo{
public static void main(String [] args) throws IOException
{
readFile();
}
public static void readFile() throws IOException
{
BufferedReader bfr=new BufferedReader(new FileReader("ini.txt"));
Properties pro=new Properties();
String line=null;
while((line=bfr.readLine())!=null)
{
String[] arr=line.split("=");
pro.setProperty(arr[0],arr[1]);
}
bfr.close();
System.out.println(pro);
}
}
收藏
举报
TAG: