title: Write to text file without overwriting in Java
body: <p>I am trying to write a method that makes a "log.txt file" if one does not already exist and then writes to the file. The problem that I am encountering is every time I call the method, it overwrites the existing log. How do I change the method so that instead of overwriting the data it just updates the file?</p>
  
  <p>My Write File Method:</p>
  
  <pre><code>    File log = new File("log.txt")
      try{
      if(log.exists()==false){
              System.out.println("We had to make a new file.");
              log.createNewFile();
      }
      PrintWriter out = new PrintWriter(log);
      out.append("******* " + timeStamp.toString() +"******* " + "\n");
      out.close();
      }catch(IOException e){
          System.out.println("COULD NOT LOG!!");
      }
  </code></pre>