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
Difference between arraylist and vector.
What must a class do to implement an interface in java programming?
Can we sort set in java?
What is treeset and treemap in java?
Is null function in java?
What is the difference between a field variable and a local variable?
What is the difference between import java.util.date and java .util?
What are the features of java?
Why deletion in linkedlist is fast than arraylist?
What is mean by exception?
Why is it important to initialize a variable?
How do you change an int to a string?
What are the Main functions of Java?
What is array class in java?
What is a website container?