Posts

Quick knowledge test on Java Serialization and Deserialization  What is serialization?  To make the object live beyond the lifetime of JVM.  Name some of the System classes in java which do not implement Serializable?  Thread, OutputStream and its sub classes, Socket, File  Can a class having a Thread object reference be persisted?  Yes just declare the thread object as transient.  Can the virtual machine call private methods of an object?  Although one object cannot call the private methods of another object, however virtual machine can call private methods of an object. In object serialization if we override methods readObject, writeObject then even though these methods are declared as private, the JVM will be able to call them.  Can we stop object serialization?  We can do it by throwing NotSerializableException (extending IOException) from overridden readObject and writeObject.  What is the difference between Serializable and Externalizable interfaces? Externaliz