What is deserialization and how do we do deserialization?
Answer Posted / javamasque
Here is updated answer
Deserialization is a process of retrieving object from byte stream. We have to fallow below steps for de-serialization
1. The object to be serialized need to implement java.io.Serializable interface.
2. It will use Java’s default serialization mechanism.
3. Generate serial version id for that serializable object.
4. Generate serial version UID for all super classes in hierarchy (all super classes if any) otherwise the properties of all its super classes will be assigned to its default value during deserializtion.
5. ObjectInputStream is used to read [readObject()] object.
6. FileInputStream is used to read from flat file.
7. The flat file extension should be (<file-name>.ser)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How many types of the indexof method are there for strings?
What is bytecode in java ?
What is finalize() function in java?
Can a constructor be private and how are this() and super() method used with constructor?
Can java inner class be static?
How many ways can we create the string object?
Is char * a string?
Can one thread block the other thread?
What is the difference between preparedstatement and statement in java?
Can we define a package statement after the import statement in java?
What does java se mean?
Can we overload the constructors?
What are classloaders?
Say you want to store the information about a number of pets in an array. Typical information that you could store for each pet (where relevant) would be • Breed of animal • Animal's name • Its birth date • Its sex • Whether it has been sterilised or not • When it is due for its next inoculation • When it last had its wings clipped For each type of pet (eg. dog, cat or bird) you would typically define a class to hold the relevant data. Note: You do not need to implement these classes. Just answer the following questions. 3.1.1 What would be the advantage of creating a superclass (eg. Pet) and declaring an array of Pet objects over simply using an array of Objects, storing each of the instances of the different pet classes (eg. Dog, Cat or Bird) in it? 3.1.2 Would you define Pet as a class or as an interface? Why? (2) (2)
What is tree node in java?