File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes object's methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object Watch "object New topic
Author

object's methods

RajivAwadhesh kumar
Greenhorn

Joined: May 20, 2011
Posts: 24
Each object has its own values for instance variables. What about object's methods?
How and where are object's stored? How are the object's methods called from where the object is stored?
Please suggest any article or tutorial about how an object is made, stored and details of how instance variables, static members of a class and instance methods are stored?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
You could sure read them from a good Java beginner's book or rather search each question using Google.
And a search for older threads in this forum yields lot of useful threads...
http://www.coderanch.com/t/416620/java/java/stored-Stack-Heap
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7016
    
  16

RajivAwadhesh kumar wrote:Each object has its own values for instance variables. What about object's methods?
How and where are object's stored? How are the object's methods called from where the object is stored?
Please suggest any article or tutorial about how an object is made, stored and details of how instance variables, static members of a class and instance methods are stored?
The fact is: you don't need to know; and in many cases these details are JVM-specific, so any answer we give you for one might not be true on another.
Java is NOT like C or C++, where understanding how objects are arranged in memory can give you some insights into how to code. In Java it's more likely to (a) distract you from what you're supposed to be doing (ie, programming), and (b) lead you down the path to dangerously brittle code.

One thing I will tell you is that methods (both static and non) are stored separately from object contents, and that usually only ONE copy of a method (again, both static and non) is kept per class...although when generics gets involved, I may not even be correct there.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4240
    
    7

Winston Gutkowski wrote:...although when generics gets involved, I may not even be correct there.

I suspect you are correct, since the generic information is lost at run-time so I don't think there'd be a need for multiple versions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object's methods
 
Similar Threads
nx:All of URLy Bird 1.1.3 about read/write lock
implementation for static and non-static methods stored in memory
Object and Varaible
static variables - kept on Heap or Stack
static vs instance methods