import java.io.*;
public static void main(String args[]){
FileOutputStream out; //declare a file output object
PrintStream p; //declare a print stream object
try{
//create a new file output stream
// connected to "myfile.txt"
out = new FileOutputStream("myfile.txt");
//connect print stream to the output stream
p = new PrintStream(out);
p.println("this is writen to a file");
p.close();
}catch (Exception e){
System.err.println("error to writing to filr");
}
}
}
No comments:
Post a Comment