I am trying to create a new file and print data to said file using the printwriter class.
My code looks like this
File Fileright = new File("C:\\GamesnewOrder.txt");
PrintWriter pw = new PrintWriter(Fileright);
for(int i =0;i<=Games2.length-1;i++)
{
pw.println(Games2[i]);
}
pw.close();
I do have the main method with a throwsIOException
.
The error java.iofilenotfound
exception keeps appearing at the line where I am creating the printwriter. So is the printwriter not creating the file?