If i create a object which is to be serialized then do I need to implement any methods?

Questions by divya_a

Showing Answers 1 - 6 of 6 Answers

You just need to implement the Interface Serializable and don't have to implements any methods.This is because Serialiazble Interface has no methods.Its just a Marker/Tag Interface which tells that this object is serilizable.ThanksGautam

  Was this answer useful?  Yes

Vijay Anand

  • Feb 27th, 2006
 

Apparently not!!. It is recommended to override equals() and hashCode() too

  Was this answer useful?  Yes

sunil kumar singh

  • Feb 28th, 2006
 

if you want to searilize any method, you just implement serilizable interface will doo, RegardsSunil

  Was this answer useful?  Yes

mujifur

  • May 2nd, 2006
 

Yes suresh you r absolutely correct.

I think,

Really, Serialized interface containa a single variable

orginal form of serialized interface is

interface serialzed

{

int var=value;(i cant remember the variable name and value)

}

                                                  thanks

                                                                                 By

                                                                               Mujifur

  Was this answer useful?  Yes

In order to serialize your object first of all you need to implement 'java.io.serializable' interface and need not implement any methods because 'serializable' is a marker interface which doesn't have any methods or variables.

Later on you need to create an 'ObjectOutputStream' object and by using the method 'writeObject(Object)' which is in 'ObjectOutputStream' class you can serialize your object.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions