title: Exception in thread "main" java.lang.ClassCastException
body: <pre><code>import java.io.*;
  
  class rak implements Serializable{
  
      int i;
  }
  
  public class Main {
  
      public static void main(String[] args) throws Exception {
          // write your code herer
          rak r = new rak();
          r.i = 9;
  
          File f = new File("da.txt");
          FileOutputStream f1 = new FileOutputStream(f);
          ObjectOutputStream oos = new ObjectOutputStream(f1);
          oos.writeObject("value of  i is" + r.i);
  
          FileInputStream f0 = new FileInputStream(f);
          ObjectInputStream f9 = new ObjectInputStream(f0);
          rak r1 = new rak();
          r1 = (rak) f9.readObject();
  
          System.out.println(r1.i);
  
      }
  }
  </code></pre>