import java.io.*;
public class FileWriter{
public FileWriter(){
try{
FileOutputStream fos =new FileOutputStream("data.txt");
BufferedOutputStream bos= new BufferedOutputStream(fos);
DataOutputStream dos= new DataOutputStream(bos);
dos.writeUTF("Testing the file program");
dos.close();
fos.close();
FileInputStream fis =new FileInputStream("data.txt");
BufferedInputStream bis= new BufferedInputStream(fis);
DataInputStream dis= new DataInputStream(bis);
String s=dis.readUTF();
System.out.println(s);
dis.close();
fis.close();
}catch(Exception e){}
}//end of constrctr
public static void main(String m[]){
new FileWriter();
}//end of main
}//end of class
No comments:
Post a Comment