title: How to write on the second line in a .txt file (java)
body: <p>I want to write a few arguments in a .txt file and I want to sort them. To do that I want to go to the next line for every groop of arguments but I dont know how to do that.I have tried the:
      <code>x.nextLine();</code>
  statement, but that is only for scanning and not for formatting.</p>
  
  <p>How can I go to the next line of a file while formatting? Is there another statement for that?</p>
  
  <p>This is the code I created:</p>
  
  <pre><code>try{
      w = new Formatter("data.txt");
  }
  catch(Exception e){
          JOptionPane.showMessageDialog(null, "Fatal Error, please Reboot or reinstal program", "Error", JOptionPane.PLAIN_MESSAGE);
  }
  
  w.format("%s,%s,%s,%s%n", book,code,author,editor);
  w.close();
  </code></pre>