读取A.tex内容删除第一个字符然后写到B.txe 在删除A.txe
能实现么?希望能给个代码!!!谢谢

解决方案 »

  1.   


    public static void main(String[] args) {
    File fa = new File("a.txt");
    File fb = new File("b.txt");

    try {

    if(!fb.exists()){
    fb.createNewFile();
    }

    ObjectInputStream ois = new ObjectInputStream (new FileInputStream(fa));
    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(fb));

    char c = ois.readChar();
    oos.writeChar(c);

    oos.close();
    ois.close();

    fa.delete();

    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
      

  2.   


    这是把a.txt里面的第一个字符写到b.txt中了把        char c = ois.readChar();
            oos.writeChar(c);自己改成一下就行
      

  3.   

     char c = ois.readChar();此处不循环能一次读的完吗
    加个while循环
      

  4.   

    用readLine就可以了,把第一行第一个字母去掉就OK了