Creating a File Using File Writer

import java.io.*
class CreateFile
{
public static void Main(String[] args) throws IOException{
String text="This is The File Content on Java" + "\n i am writing This in the
File";
// Attach a file to FileWriter
FileWriter fw=new FileWriter("TestFile");
// read the character wise from string and write into file
for(int i=0;i fw.write(text.charAt(i));
//close the file
fw.close();
}
}

No comments:

Post a Comment