你在hashtable中存放格式:Value.value ---4
Value.time-----9
STORE.values---StoreTest
STORE.color----Blue再下面应该不用我再说了吧!(就是读取hashtable中的内容了)呵呵!这下没有问题了吧!

解决方案 »

  1.   

    String strFile;\\ 将文件通过FileReader存到一个字符串 strFile
    ...StingTokenizer st=new StingTokenizer( strFile , "\r\n" );
    while( st.hasMoreTokens()){
      String line = st.nextToken().trim();
      if(line.length()==0)continue;
      if(line.startsWith( "[" ) &&  line.endsWith( "]" )){
        System.out.println( "段:"+line.substring( 1 , line.length()-1 ));
      } else {
        int equpos = line.indexOf( "=" );
        if( equpos==-1 )continue;
        System.out.println( "键:"+line.substring( 0 , equpos )+" = " + line.substring( equpos+1 , line.length() ));
      }
    }
        
      

  2.   

    谢谢各位的回复 , 不过没有直接读取类似文件的方法吗? 比如像Delphi中的function ReadString(const Section, Ident, Default: String): String; override; 类似方法读取初始化文件就比较简单(当然我知道java中可以自己写上面格式的方法).
      

  3.   

    Java中有Properties这样的类专门处理 properties配置文件,hao好像没有现成的处理ini文件的类,所以java中写配置文件多用properties或者是xml
      

  4.   

    JAVA里没有读取ini文件的方法,JAVA最方便的是properties文件