用JAVA如何读写文件 这个!?以前有很多的帖子都是关于这的,自己找找吧! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.util.*;import java.io.*;public class WriteText{ public static void main(String[] args){ try{ PrintWriter pw=new PrintWriter(new FileOutputStream("Answer.txt")); System.out.println(i); pw.print("12121212 "); pw.flush(); } catch(FileNotFoundException e) { System.out.println(e.getMessage()); } catch(IOException e) { System.out.println(e.getMessage()); } } } 在该文件的相同目录下建立Answer.txt文件,运行以后可以将"12121212"写入该文件 [请教]关于static变量的使用场合的问题 求助一个小问题 问个基础问题 要实现Class.forName是在哪里配呢?环境变量吗? java的动态二维用什么? error: cannot read: HelloWorld.java 郁闷,IO问题,请高手指教 大家帮帮忙,有点急! 关于Java Mail Api,请高手帮忙!!! 为什么我用JBuilder3编译的CLASS文件不能在SUN的JDK下运行?(没有用JBCL) 兄弟我要用java做个网站监控系统,不知如何下手,请高手给点意见!!!! 如何从文件的指定位置把文件内容读入字符型数组?
import java.io.*;public class WriteText{
public static void main(String[] args){
try{
PrintWriter pw=new PrintWriter(new FileOutputStream("Answer.txt"));
System.out.println(i);
pw.print("12121212 ");
pw.flush();
}
catch(FileNotFoundException e)
{
System.out.println(e.getMessage());
}
catch(IOException e)
{
System.out.println(e.getMessage());
}
}
}
在该文件的相同目录下建立Answer.txt文件,运行以后可以将"12121212"写入该文件