日期:2014-05-16 浏览次数:21112 次
public static void main(String[] args) throws Exception { // TODO Auto-generated method stub File saveFile = new File("a"); // RandomAccessFile accessFile = new RandomAccessFile(saveFile, "rwd"); // accessFile.close(); RandomAccessFile accessFile1 = new RandomAccessFile(saveFile, "rwd"); accessFile1.writeChars("4454545"); accessFile1.close(); }
?
对于这句代码说明:
RandomAccessFile accessFile1 = new RandomAccessFile(saveFile, "rwd");
?
不管怎样,都对saveFile这个文件进行随机读写的,如果不存在saveFile文件,就会自动创建一个空白文件的!