title: Alternative ways to write a file in Java
body: <p>I have next function:<br/></p>
  
  <pre><code>static void write()
  {
      try {
           File file = new File ("flip.out");
           BufferedWriter out = new BufferedWriter(new FileWriter(file));
           out.write(sMax);
           System.out.println(sMax);//This command it works
           out.close();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>The problem is that my program doesn't write anything in my file.</p>