本帖最后由 yangkuanku 于 2009-09-16 19:57:55 编辑

解决方案 »

  1.   

    D:\\Homeworks\\eclipse work place\\SuanFa\\src\\class1\\output.txt
    路径中最好不要有空格,改改看。
      

  2.   

    没看明白你的题是什么意思,我做了个简单的,你参照一下吧,希望对你有帮助。
    FileReader rf = null;
    FileWriter fw = null;
    BufferedReader br = null;
    try {
    rf = new FileReader("d://a.txt");
    fw = new FileWriter("d://b.txt");
    br = new BufferedReader(rf);
    char [] str = br.readLine().toCharArray();
    Map map = new HashMap();
    for(int i=0;i<str.length;i++){
    if(map.containsKey(str[i]))
    map.put(str[i],(Integer) map.get(str[i])+1);
    else
    map.put(str[i],1);
    }
    fw.write(map.toString());
    System.out.println(map);
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }catch(IOException ce){
    ce.printStackTrace();
    }
    finally{
    try{
    fw.flush();
    fw.close();
    br.close();
    rf.close();
    }catch(Exception ce){
    ce.printStackTrace();
    }
    }
      

  3.   

    对了忘说了 a.txt里写的是123412938749这样的数。