jGuru
Register Email     Password Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search   jGuru Search Help

Question Are methods also serialized along with the data members?
Derived from A question posed by Sunder Raman Venkataraman
Topics Java:API:Serialization
Author Tim Rohaly PREMIUM
Created Sep 18, 2000 Modified Sep 18, 2000


Answer
No. Method bodies do not hold any information on the state of an object, so they are not needed in order to save or restore the state.

Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Comments and alternative answers

Comment on this FAQ entry

Serialization is for saving the state of an object...
V S N Murthy Boggavarapu, Oct 18, 2000  [replies:1]
Serialization is for saving the state of an object instance, whereas the object's methods and static fields are class-level properties. So, there is no need to serialize methods and static members.

Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Reply to this answer/comment  Help  
Re: Serialization is for saving the state of an object...
krishna raj, Jun 22, 2004
But when a method is invoked on an object that has been serialized and sent across from another JVM, does this method invocation have to happen on the original object and not on the serialized object, thus involving a network call.
For Eg. let's assume a client/server scenario (either Sockets or RMI) with CustomerManager and Customer classes in the server. Only Customer class implements Serializable. 1. Client creates CustomerManager (gets a reference only since it is not serializable) and calls a create() method (assume) on CustomerManager to create a Customer. 2. The above call goes to the server and returns a Serialized Customer object to the client (via proxy/stub or whatever). 3. Client invokes getCustName() method on Customer. Suppose this method returns the Customer Name in upper case. Does this method invocation have to go back to the Server ?Does the client have the implementation of the method as part of the serialized object, so that the method can be executed locally ?


Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Reply to this answer/comment  Help  


Ask A Question



 
Related Links

Serialization FAQ

Serialization Forum

Serialization specification

Sun's Java Tutorial

Wish List
Features
About jGuru
Contact Us

 



The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers