• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Static

 
Greenhorn
Posts: 24
Android Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Static members are loaded at runtime or compile time.....??
 
Ranch Hand
Posts: 40
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is nothing called 'loading' when compiling. Compiling a java program is just converting your human readable java code in to a machine readable language when interpreted by JVM.
 
Abhishek Bose
Greenhorn
Posts: 24
Android Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Buddhika Mawella wrote:There is nothing called 'loading' when compiling. Compiling a java program is just converting your human readable java code in to a machine readable language when interpreted by JVM.



i mean when it gets on to heap.....!
 
Buddhika Mawella
Ranch Hand
Posts: 40
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When a java program is compiling there is nothing called heap or stack. Stack and heap only exist on runtime.
 
Marshal
Posts: 76447
366
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you actually mean is, "Are the static members of a class loaded into memory before or after an instance is created?"

As far as I know, they are part of the class file, which is loaded into memory by the class loader when the class is needed, before any instances are created. Search for the BCEL Manual, which is out of date, but still probably useful, or go through the JVM Specification.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think its Runtime
 
Abhishek Bose
Greenhorn
Posts: 24
Android Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Buddhika Mawella wrote:When a java program is compiling there is nothing called heap or stack. Stack and heap only exist on runtime.



So that means each and every member in a java program gets on to the heap during runtime and not before..?
 
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abhishek Bose wrote:

Buddhika Mawella wrote:When a java program is compiling there is nothing called heap or stack. Stack and heap only exist on runtime.



So that means each and every member in a java program gets on to the heap during runtime and not before..?


Heap or stack, yes. Remember, the program is probably compiled on a different computer to the one it is run on. So how can the memory of the running machine possibly be affected during compilation?
 
She's brilliant. She can see what can be and is not limited to what is. And she knows this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic