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 is the largest number a double can hold?

801


What is the class in java?

785


Difference between start() and run() method of thread class?

835


What is the difference between throw and throws keywords?

835


What is the main difference between java platform and other platforms?

730


How can we make a class singleton?

840


Can we override compareto method?

737


What do you understand by synchronization?

819


What is lambda expression in java?

748


What are the different types of java?

786


Can we restart a dead thread in java?

773


What is entry set in java?

757


How many types of constructors are used in java?

832


Which of the classes will have more memory allocated?

751


Justify your answer that you can't define a method inside another method in java, if you can then how?

831