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