File writer not typing in file (Java)
<p>I made a program to produce a file with numbers in it
But the program is not typing any thing in the file it created!</p>

<p>This is the code:</p>

<pre><code>     private void OpenMenuActionPerformed(java.awt.event.ActionEvent evt) {                                         
    ModFile=new File(NameText.getText() + ".mod");
    FileWriter writer = null;
    try {
        writer = new FileWriter(ModFile);
    } catch (IOException ex) {
        Logger.getLogger(ModMakerGui.class.getName()).log(Level.SEVERE, null, ex);
    }
   if(!ModFile.exists()){
   try {
   ModFile.createNewFile();
   System.out.println("Mod file has been created to the current directory");
   writer.write(CodesBox.getText());
   } catch (IOException ex) {
   Logger.getLogger(ModMakerGui.class.getName()).log(Level.SEVERE, null, ex);
       }
     }     
   }                      
</code></pre>

<p>When i create a random file, i don't see any thing when i open it!
Please help<br>
Thanks Amir for helping but i noticed i should use FileOutputStream and DataOutputStream...<br>
So, i need help again cause the same problem appeared :(</p>

<pre><code> File ModFile =new File(NameText.getText() + ".mod");
try {
    FileOutputStream fos = new FileOutputStream(ModFile);
    DataOutputStream dos = new DataOutputStream(fos);
    int i = Integer.parseInt(CodesBox.getText());
    dos.writeInt(i);
        // and other processing 
} catch (IOException ex) {
    Logger.getLogger(ModMakerGui.class.getName()).log(Level.SEVERE, null, ex);
}finally{
    try{
         dos.close();
    } catch(IOException e) {
        e.printStackTrace();
    }
}
</code></pre>

<p>NetBeans said they cannot find the symbol dos at (dos.close();)</p>

<p>Please help me here again</p>
