title: Why does the value of count in the data file not increment?
body: <p>Despite writing the integer into the data file, the total bytes available in the file remain 0.</p>
  
  <pre><code>public class Q 
  {
      public static void main(String[] args) throws IOException 
      {
          DataOutputStream output = new DataOutputStream(new FileOutputStream("count.dat"));
          DataInputStream input = new DataInputStream(new FileInputStream("count.dat"));
          if (input.available()==0) 
          {
              output.writeInt(1);
          }
          else
          {
              int count = input.readInt() + 1;
              System.out.println(count);
              output.writeInt(count);
          }
          output.close();
          input.close();
      }
  }
  
  </code></pre>