I do not know how you can run this file when in the state as is it would not compile with about 10 error messages. What about class declaration
public class CreateTestTxt for example
import java.io.*;
import java.util.*;
public class CreateTestTxt
{
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());
}
}
}
Difficult to comment on realy beginners stuff which you should know
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
Offline 6,658 posts
since Dec 2004