What is the need to implement Serializable interface (with
no methods) for objects which are to be serialized ?
We can write our own functionality which writes objects to
streams then why we need to implement and tell JVM that
which objects can be serialized.

Answer Posted / aman kr aggarwal

well if we dont use Serializable interface which is a
marker interface, then the object which we want to
serialize and use writeObject() method then compiler would
throw exception as if other object which r related to that
object if not serialized.
So. to overcome this we have to use Seializable interface.

Is This Answer Correct ?    3 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are passing parameters?

585


How does hashset work in java?

563


What are conditionals and its types?

580


What is method overloading in JAVA? Why is it not present in C ?

586


What is the intersection and union methods?

546






What is operator overloading. Is it is supported in java?

516


What is the difference between variable declaration and variable initialization?

502


What are the approaches that you will follow for making a program very efficient?

640


What is difference between adapter class and listener?

495


What is intern method in java?

578


How do you call a reference in java?

515


How does remove work in java?

517


What does function identity () do?

515


When is the finally clause of a try-catch-finally statement executed?

497


Explain garbage collection in java?

541