How will you override default serialization mechanism in java
Answer Posted / amit singh
you can inplements the Serialization interface for those
class you want to serailize
its marker interface its haven't any behaviour
but it indiacte that particular class is serializable
you can read and write particular object to convert in a
byte.
class Amit implements Serializable
{
Amit()
{
}
}
class B
{
public static void main(String []args)
{
Amit a = new Amit();
try{
}
catch{IoExcepton e)
{
}
try{
FileIntputStream f = new FileIntputStream("apoorva.txt")
OjectIntputStream o = new ObhjctInputStream(f);
o.ReadObject();
}
catch(IoException e)
{
}
}
thanks amit singh
amitsing2008@gmail.com
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the difference between processes and threads?
What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?
Can we declare a class as static?
What is the internal implementation of set in java?
What is n in java?
What are the basic concepts of OOPS in java?
What is compiler and what its output.
What is data type in computer?
What is the dot operator?
Which package is used for pattern matching with regular expressions?
What is the difference between abstraction and encapsulation?
Can this keyword be used to refer static members?
What is the difference between sleep and wait in java?
How do you compare objects in java?
What are 5 boolean operators?