title: Java Serialization for Extended Class
body: <p>In java serialization class Mp3player extends ElectronicDevice implements Serializable in this code super class electronicdevice is not implemented serializable. here super class is also getting serialized. my understanding is super class is also gets serialized due to extends.let me know my understanding is correct or not.</p>
  
  <pre><code> import java.io.*;
   class ElectronicDevice { 
        ElectronicDevice() 
        {
             System.out.print("ed "); 
        }
    }
   class Mp3player extends ElectronicDevice implements Serializable {
         Mp3player() 
         { 
            System.out.print("mp "); 
         }
   }
  class MiniPlayer extends Mp3player {
       MiniPlayer()
       { 
           System.out.print("mini "); 
       }
       public static void main(String[] args) {
            MiniPlayer m = new MiniPlayer();
            try {
                   FileOutputStream fos = new FileOutputStream("dev.txt");
               ObjectOutputStream os = new ObjectOutputStream(fos);
                   os.writeObject(m); os.close();
  
                   FileInputStream fis = new FileInputStream("dev.txt");
                   ObjectInputStream is = new ObjectInputStream(fis);
                   MiniPlayer m2 = (MiniPlayer) is.readObject(); 
                   is.close();
                   System.out.println();
            } catch (Exception x) {
                  System.out.print("x "); 
            }
       }
    }
  </code></pre>