M
maomaoel
Unregistered / Unconfirmed
GUEST, unregistred user!
import java.io.*;
import java.applet.*;
import java.awt.*;
public class fileinputdemo extends Applet
{
public void start(){
String str="my name is maomaoel";
byte buf[]=str.getBytes();
try
{
FileOutputStream f=new FileOutputStream("demo.txt");
for(int i=0;i<buf.length;i++)
f.write(buf);
f.close();
}
catch(FileNotFoundException e)
{System.out.println("file e");}
catch(IOException e1)
{System.out.println("io e");}
}
}
编译通过,运行时出错,请问APPLET应该怎样实现我想要的结果
import java.applet.*;
import java.awt.*;
public class fileinputdemo extends Applet
{
public void start(){
String str="my name is maomaoel";
byte buf[]=str.getBytes();
try
{
FileOutputStream f=new FileOutputStream("demo.txt");
for(int i=0;i<buf.length;i++)
f.write(buf);
f.close();
}
catch(FileNotFoundException e)
{System.out.println("file e");}
catch(IOException e1)
{System.out.println("io e");}
}
}
编译通过,运行时出错,请问APPLET应该怎样实现我想要的结果