怎么以追加的方式打开文件啊?或者怎样往文件的末尾加入一行? 感谢各位给给指点一二 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你往文件写东西要用到FileWrite类。FileWriter(File file, boolean append) Constructs a FileWriter object given a File object我想你看这知道怎么用了吧! 用java.io.RandomAccessFile中的length() 和seek(long pos)方法 用 RandomAccessFile的seek()和length(); RandomAccessFile类seek(long pos)方法为指向指定位置write(byte b[], int off, int len):write(mybyte,0,1024);意思是在文件的pos位置处(注意这里的0不是指从文件开头,而是指从指定位置开始),写入长度为1024的mybyte数组的数据。 tjl713(tjl) 说的对,把FileWriter(File file, boolean append) 中的append设为true就可以了 java 日期 字符串 加法 跪求,引用 程序出错 如何用java定义动态二维数组 正则表达式(?s)<(A).*>(.*)?<\\/\\1>,开头的(?s)是什么意思? tomcat如何实现双机热备? @@@@@@有个简单的问题请教 如何将JAVA程序发布? 想做java程序员有没有必要学jsp 来者有分 有点疑惑??? 使用java的 socket 用ByteArrayOutputStream 是的write(byte[] b, int off, int len)中的b的大小为何只能1024个字节大于1k就错了! 没法实现接口? 大家唻说说大小写敏感吧!
FileWriter(File file, boolean append)
Constructs a FileWriter object given a File object我想你看这知道怎么用了吧!
seek()和length();
seek(long pos)方法为指向指定位置write(byte b[], int off, int len):
write(mybyte,0,1024);意思是在文件的pos位置处(注意这里的0不是指从文件开头,而是指从指定位置开始),写入长度为1024的mybyte数组的数据。