Quick Refresh : JAVA : Serialization
Serialization Questions | ||||
Q1) What is Serialization? Ans) Serializable is a marker interface. When an object has to be transferred over a network ( typically through RMI or EJB) or persist the state of an object to a file, the object Class needs to implement Serializable interface. Implementing this interface will allow the object converted into bytestream and transfer over a network. | ||||
Q2) What is use of serialVersionUID? Ans) During object serialization, the default Java serialization mechanism writes the metadata about the object, which includes the class name, field names and types, and super-class. This class definition is stored as a part of the serialized object. This stored metadata enables the deserialization process to reconstitute the objects and map the stream data into the class attributes with the appropriate type
List of incompatible changes:
So, if no suid is present , inspite of making compatible changes, jvm generates new suid thus resulting in an exception if prior release version object is used . | ||||
Q3) What is the need of Serialization? Ans) The serialization is used :-
| ||||
Q4) Other than Serialization what are the different approach to make object Serializable? Ans) Besides the Serializable interface, at least three alternate approaches can serialize Java objects: | ||||
Q5) Do we need to implement any method of Serializable interface to make an object serializable? Ans) No. Serializable is a Marker Interface. It does not have any methods
|
Comments
Post a Comment