黑马程序员 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:

 

评分:0

我来说两句

日历

« 2024-05-07  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 6597
  • 日志数: 16
  • 建立时间: 2013-12-02
  • 更新时间: 2014-07-14

RSS订阅

Open Toolbar