title: How to write to file
body: <p>I tried to make a console app that creates a file and writes text to it. What did I do wrong here?</p>
  
  <pre><code>package Writer;
  
  import java.util.*;
  import java.io.*;
  
  
  public class main {
  
      public static void main(String args[]) {
  
      System.out.println("What would you like your SimpleText file name to be?");
      Scanner uInputName = new Scanner(System.in);
      String fileName = uInputName.nextLine();
  
      File file = new File(fileName);
  
      FileWriter fw = FileWriter;
      BufferedWriter Text = new BufferedWriter(fw);
      {
  
          System.out.println("What would you like to write in: " + fileName);
  
          Scanner uInputText = new Scanner(System.in);
          String fileText = uInputText.nextLine();
  
          fw.write(fileText);
          Text.newLine();
      }
  
      System.out.println("Okay. File saved.");
  
  }
  </code></pre>