Hi all,
I am trying to create a file and write something into that file.
Here's what I have tried:
import java.io.*;
import java.util.*;
public static void main (String[] arg)
{
try
{
String file_name = "test.txt";
FileWriter file = new FileWriter(file_name);
BufferedWriter out = new BufferedWriter (file);
String text = "This is goint to be written to the file";
out.write(text);
out.close();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
}
But, when I run this program, no file is created. Can someone help me out with that. Where I went wrong.
Thanks.