/*
* To
change this template, choose Tools | Templates
* and
open the template in the editor.
*/
package progfilewrite;
import java.io.*;
/**
*
* @author
Acer
*/
public class ProgFileWrite {
/**
*
@param args the command line arguments
*/
public
static void main(String[] args) {
//
TODO code application logic here
boolean kondisi=false;
try
{
String dir="C:\\Document and Setting\\Yuniar Supardi\\My
Documents\\NetBeansProjects\\ProgFileWriter";
String fileku="Dataku.txt";
File Dataku=new File(dir,fileku);
if (Dataku.exists())
{
kondisi=true;
}
else
{
Dataku.createNewFile();
}
PrintWriter filekeluar=new PrintWriter(new
FileWriter(Dataku.getPath(),kondisi));
String[] ket={"Acer\n","Ahli Pemrogramaman\n"};
for (int i=0;i<ket.length;i++)
{
filekeluar.println(ket[i]);
}
filekeluar.close();
}
catch (IOException e)
{
System.out.println("Ada Kesalahan file"+e);
}
}
}