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
Why scanner is used in java?
Why singleton class is used in java?
How thread scheduler schedule the task?
What does the @override annotation do?
Why multiple inheritance is not supported by java?
What language is an assembler written in?
What is __ init __ functions?
what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread
Explain about serializable interface in java?
Compare java and python.
What is a superclass?
What is stored procedure. How do you create stored procedure ?
What is singleton math?
What is the latest version of java?
What do you mean by inner class in java?