title: how to append the data in java file?
body: <p>i just need your help. I'm learning java(OOP) and now days we are working on filing. But i got stuck on how to append data in the file. I have written the code and and here's the part of it which is showing the error. Can someone please help me what's wrong with it and why it is not working?</p>
  
  <pre><code> package appending;
   import java.io.FileNotFoundException;
   import java.util.Formatter;
   import java.util.Scanner;
   import java.io.FileWriter;
   import java.io.BufferedWriter;
  
  
  public class open {    
  Formatter output;    
  public void openFile() throws FileNotFoundException {    
      output = new Formatter("E:/thisFile.txt");
  }
  public void addData() {    
   Scanner input = new Scanner(System.in);
   data d = new data();
   System.out.println("Enter the data");
   d.setData(input.next(),input.nextInt());
   output.format("%s","Name and CMS:\t"+d.getData());
   FileWriter fileWritter = new FileWriter(File.getPath(),true);
   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
   bufferWritter.write(d.getData());
   bufferWritter.close();
  }
  public void close() {
   output.close();
  }
  }
  </code></pre>