title: Append text to file and print it's contents to console simultaneously?
body: <p>I've spent over an hour on this, and i just can't get any text to show up in the .txt file. What am i doing wrong?</p>
  
  <pre><code>import java.util.*;
  import java.io.*;
  public class writer {
  public static void main(String[] args) {
      try {
          File txt = new File("myTextFile.txt");
          FileWriter fw = null;
          fw = new FileWriter(txt);
          BufferedWriter edit = null;
          edit = new BufferedWriter(fw);
          String s = "more text", line = null;
          edit.write(s);
          Scanner sc = new Scanner(txt);
          while (sc.hasNextLine()) {
              String i = sc.nextLine();
              System.out.println(i);
          }
          sc.close();
      } catch (IOException e) {
          e.printStackTrace();
    }
   }
  }
  </code></pre>
  
  <p>Edit: Added a <strong>.write</strong>, but it's still not working</p>