title: PrintWriter Not Writing to java file
body: <p>I have been trying to get my code to print to notepad for hours. Basically I create a file and put 10 random integers in it. Then I create another file that multiplies those 10 random ints from the first file by 10. I have tried flushing, open close, etc. I am assuming there is a problem in my code. Thanks!</p>
  
  <pre><code>    import java.io.File;
  
  
      import java.util.Random;
      import java.io.PrintWriter;
  public class UghFiles {
  
      public static void main(String[] args) throws Exception{
          // TODO Auto-generated method stub
  
          Random rand = new Random();
          int x = 0;
          File file = new File("LearnProgram.txt");
  
          if(file.exists()) {
  
              System.out.println("File alrady exists");
              System.exit(0);
          }
          else {
              PrintWriter output = new PrintWriter(file);
              for(int i= 0; i&lt;10; i++){
                  x = 0 + rand.nextInt(99-0)+1;
  
                  output.print(x);
                  //System.out.print(x + " ");
                  //System.out.print("");
  
              }
              output.close();
          }
          File f2 = new File("Multiply.txt");
          if(f2.exists()) {
  
              System.out.println("File already exists");
              System.exit(0);
          }
          else {
              java.util.Scanner input = new java.util.Scanner(file);
              PrintWriter output = new PrintWriter(file);
  
              while(input.hasNext()) {
                  x = x*10;
  
                  output.println("" + x);
                  System.out.print(x);
              }
              output.close();
              input.close();
          }
  
      }   
  }
  </code></pre>