aspose file tools*
The moose likes Beginning Java and the fly likes object member Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object member" Watch "object member" New topic
Author

object member

Yasir Qureshi
Ranch Hand

Joined: Apr 27, 2001
Posts: 44
Today I gave an interview, one question i was asked is that " when object is created each object got different copy of data member (non static), does all objects have their own copy of non static methods"
I replied no only data memebers r contained not methods, AM I RIGHT.
Yasir Sufyan
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Yasir,
IMO, you are right. Instance methods are defined as:
A method which belongs to an instance of the class. Objects of the same class share its implementation.
Regards,
Manfred.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Methods, static and non-static, are held in the Method area that is created one time at Class Load time. They are in no way involved with the instance objects that are on the heap.
Objects ONLY hold the values of the fields (member variables) which define the STATE of the object, NOT the behaviors of the object.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object member