title: Saving integer input in a .txt file (Java)
body: <p>I'm trying to get the integers I enter to be written to a text file, yet however I edit the code my notepad spits out my integers as nonsense. Example:</p>
  
  <p>Integer inputted: java.util.Scanner[delimiters=\p{javaWhitespace}+][position=1][match valid=true][need input=false][source closed=false][skipped=false]...     </p>
  
  <p>I believe my problem is in the line which I have marked with a "*". How would I go about fixing this? I believe it has something to do with the  "String.valueOf(input)" line. Full code linked below!</p>
  
  <pre><code>for (int i = 0 ; i &lt; 10 ; i++) {
               System.out.printf("Please enter integer %d: ", i+1);
               numbers[i] = input.nextInt();
  
               {
                   try
                   {
                      *output.format("Integer inputted: %s%n", String.valueOf(input));
                   }
                   catch (FormatterClosedException formatterClosedexception)
                   {
                       System.err.println("Error writing to the file. Terminating.");
                       break;
                   }
                   catch (NoSuchElementException elementException)
                   {
                       System.err.println("Invalid input. Please try again.");
                       input.nextLine();
                   }
  </code></pre>
  
  <p><a href="http://pastebin.com/yV6dhSMt" rel="nofollow">http://pastebin.com/yV6dhSMt</a></p>