日期:2014-05-20 浏览次数:20836 次
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(); } }
------解决方案--------------------