How to Create file in Java


import java.io.File;
import java.io.FileWriter;
import java.io.BufferedWriter;

public class JavaIOWriteFileExample {

    public static void main(String[] args) {

        File f=new File("c:\\createNewfile.txt");

        try{
            FileWriter fstreamCopy = new FileWriter(f);
            BufferedWriter outobjCopy = new BufferedWriter(fstreamCopy);
            outobjCopy.write("The content write to inside the file");
            outobjCopy.close();
         }
        catch (Exception e){
              e.printStackTrace();
         }
    }
}

1 comments:

mansur said...

edirne
hatay
ığdır
ısparta
muş

H11NKH

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|