请问哪有有关“文件操作”的源码:急!一定给分!!

javagoo 2002-01-29 08:50:21
...全文
122 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
gzgangster 2002-01-30
  • 打赏
  • 举报
回复
String logFile ="c:/test.xls";
FileWriter fw = new FileWriter(logFile,true);
fw.write(String content);
fw.flush();
gzgangster 2002-01-30
  • 打赏
  • 举报
回复
String logFile ="c:/test.xls";
FileWriter fw = new FileWriter(logFile,true);
fw.write(String content);
fw.flush();
skyyoung 2002-01-30
  • 打赏
  • 举报
回复
看看java.io的库类。有很多。
javagoo 2002-01-30
  • 打赏
  • 举报
回复
兄弟们的主意都不错!哎,看来还是找找!像evergreen(永远的绿)这位老兄不错噢!谢谢了! 
gzgangster 2002-01-30
  • 打赏
  • 举报
回复
String logFile ="c:/test.xls";
FileWriter fw = new FileWriter(logFile,true);
fw.write(String content);
fw.flush();
hexiaofeng 2002-01-30
  • 打赏
  • 举报
回复
搜索论坛
pengji 2002-01-29
  • 打赏
  • 举报
回复
CSDN的翻译文档中有一片,很好的!
FlyCom_NT 2002-01-29
  • 打赏
  • 举报
回复
到googl.com里搜索一下
evergreen 2002-01-29
  • 打赏
  • 举报
回复
是要进行什么操作呢?读?写?
import java.io.*;

class FileReadTest {
public static void main (String[] args) {
FileReadTest t = new FileReadTest();
t.readMyFile();
}

void readMyFile() {
String record = null;
int recCount = 0;
try {
FileReader fr = new FileReader("mydata.txt");
BufferedReader br = new BufferedReader(fr);
record = new String();
while ((record = br.readLine()) != null) {
recCount++;
System.out.println(recCount + ": " + record);
}
br.close();
fr.close();
} catch (IOException e) {
System.out.println("Uh oh, got an IOException error!");
e.printStackTrace();
}
}

}

---------------
import java.io.*;

class FileWriteTest {
public static void main (String[] args) {
FileWriteTest t = new FileWriteTest();
t.WriteMyFile();
}

void WriteMyFile() {
try {
FileWriter fw = new FileWriter("mydata.txt");
PrintWriter out = new PrintWriter(fw);
out.print(“hi,this will be wirte into the file!”);
out.close();
fw.close();
} catch (IOException e) {
System.out.println("Uh oh, got an IOException error!");
e.printStackTrace();
}
}

}

23,405

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧