At time of deserialization by below code
FileInputStream out= new FileInputStream("c://ser//ser.txt");
ObjectInputStream outs= new ObjectInputStream(out);
Employee e=(employee)outs.readObject();
If JVM unable to identify the class type i.e. when outs try to call method readObject and programmer given wrong class reference then it will throw exception
java.lang.ClassCastException: Serlialization.employee1
No comments:
Post a Comment