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
which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?
What's the difference between int and integer in java?
What is json parser in java?
Explain about main() method in java ?
What is isa relationship?
Why to use nested classes in java?
According to java operator precedence, which operator is considered to be with highest precedence?
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
What is the longest unicode character?
How do you sort data in java?
What is a function easy definition?
What is the difference between equals() and?
What is the purpose of the strictfp keyword?
Why array is used in java?
Why are arrays useful in java?