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 are the various access specifiers for java classes?
Is it possible to use Semaphore/ Mutex in an Interrupt Handler?
What is default locale java?
What is string substring?
Is there a case when finally will not execute?
What is double data type?
Can a class be declared as static?
Which is bigger double or float?
What is the use of singleton?
What is an iterator interface in java programming?
What is difference between add() and addelement() in vector?
How many bits is size_t?
What is a wrapper method?
Explain abstract class in java?
Can I declare class as static or private?