怎样向一个文件写入一个StringBuffer类的对象啊! 你是不是那个文件是只读的啊?D:/1.txt 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SecurityException - if a security manager exists and its checkRead method denies read access to the file or the mode is "rw" and the security manager's checkWrite method denies write access to the file. 首先D:/1.txt不能是只读的,另外如果你的程序是写在applet里的,applet是不能访问文件系统的,会抛出安全问题的违例来。 public class Sb { StringBuffer sb=new StringBuffer("nihao"); public Sb() { try{ PrintWriter p=new PrintWriter(new FileOutputStream("d:/1.txt")); p.println(sb.toString()); p.close(); }catch(IOException e){ e.printStackTrace(); } } public static void main(String[] args) { new Sb(); }} 是啊我的是一个APPLET,那我该怎样把一个APPLET处理的内容保存到本地的硬盘下呢!请帮个忙啊! 正则表达式问题,数字判断 文件的操作程序 IO小问题 问个比较菜的 关于读取xml中格式的问题?请问回车是否能够读取到? 关于Frame的windowsListener原理的疑问 java中,用于线程控制的wait() 怎样在JFrame中更换窗体的图标? SortedSet ,SorteMap ,TreeSet() ,TreeMap() Socket VS Rmi 请问在Java中求立方和平方的函数是什么? set a icon for JRadioButton
StringBuffer sb=new StringBuffer("nihao");
public Sb() {
try{
PrintWriter p=new PrintWriter(new FileOutputStream("d:/1.txt"));
p.println(sb.toString());
p.close();
}catch(IOException e){
e.printStackTrace();
}
}
public static void main(String[] args) {
new Sb();
}
}
我的是一个APPLET,那我该怎样把一个APPLET处理的内容保存到本地的硬盘下呢!
请帮个忙啊!