package a;
import java.io.*;
import java.io.FileOutputStream;
/**
*
* @author indha
*/
public class tulisfile {
public static void main(String args[]){
FileOutputStream out=null;
String data="ok semangat";
//buka file
try{
out=new FileOutputStream("d:/contoh.txt");
}catch(FileNotFoundException fn){
System.out.println("file tidak ditemukan");
}
//menulis
try{
for(int i=0;i<data.length();i++){
//konfersidata
out.write((int)data.charAt(i));
}
}catch(IOException io){
System.out.println(io.getMessage());
}
//tutup
try{
out.close();
}catch(IOException eo){}
}
}
import java.io.*;
import java.io.FileOutputStream;
/**
*
* @author indha
*/
public class tulisfile {
public static void main(String args[]){
FileOutputStream out=null;
String data="ok semangat";
//buka file
try{
out=new FileOutputStream("d:/contoh.txt");
}catch(FileNotFoundException fn){
System.out.println("file tidak ditemukan");
}
//menulis
try{
for(int i=0;i<data.length();i++){
//konfersidata
out.write((int)data.charAt(i));
}
}catch(IOException io){
System.out.println(io.getMessage());
}
//tutup
try{
out.close();
}catch(IOException eo){}
}
}
23.16
0 komentar:
Posting Komentar