• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

object's methods

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
https://coderanch.com/t/416620/java/java/stored-Stack-Heap
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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've been selected to go to the moon! All thanks to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic