title: FileWriter in java not writing to txt file
body: <p>I am trying to get input from a <code>JOptionPane</code> and store what the user typed into a text file using the <code>FileWriter</code> class.To make sure that the input from what the user typed was being stored I wrote a system.out and what I typed in the JOptionPane appears. Unfortunately when I open the .txt file nothing I entered appears! By the way, the file path I entered is correct.</p>
  
  <p>Here is my code. HELP ME!</p>
  
  <pre><code>String playername = JOptionPane.showInputDialog("What Will Be Your Character's Name?");
  System.out.println(playername);
  try {
      FileWriter charectersname = new FileWriter("/Users/AlecStanton/Desktop/name.txt/");
      BufferedWriter out = new BufferedWriter(charectersname);
      out.write(playername);
      }
  catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
  }
  </code></pre>