Write a File
Hi,
I am new to Java Programming . I can't compile my program. I have installed latest JDK version. I want to make "myfile.txt" file, which will have "hello world!" written in it. Do I need to install something else?
import java.io.*;
publicclass MyFirstFileWritingApp{
publicstaticvoid main (String args[])
{
FileOutputStream fout;
try
{
fout =new FileOutputStream ("myfile.txt");
new PrintStream(fout).println ("hello world!");
fout.close();
}
catch (IOException e)
{
System.err.println ("Unable to write to file");
System.exit(-1);
}
}
}

