Minggu, 18 April 2010

Java file3

import java.io.*;
class File3{

public static void main(String[] args) {
File f;
f = new File("Latihan.txt");

try{
OutputStream fs = new FileOutputStream(f);
String s = "ini adalah file latihan";

byte b[] = new byte[s.length()];
for(int i=0;i b[i] = (byte)s.charAt(i);
}
fs.write(b, 0, s.length());
fs.close();
}catch(Exception e){
}
}
}