• 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

Can anybody tell me...????

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frndz,
can someone tell me what is Compile-time constant. and also mentioned compile-time constant (if posible).
thanx
aftab abbasi
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compile time constant means just that! A thing which is known to be constant at the time the program is compiled.
For eg, final int i = 10; 'i' is a compile time constant because the compiler knows that as it is final, it will never ever change. On the other hand, int i = 10; is not a constant because, the value of i can be changed anywhere in the program.
HTH,
Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
H, Aftab
I think your question is over the Core section, but I glad to help you understand the mechanism of allocation of JVM.
JVM uses two seperate heaps to handle the memory allocation. One is responsible for static allocation and another is for dynamic allocation. when you define a final varible, it is allocated in to a heap which cannot clloected by gc. So it stays in memorey until the application is over. All class definitions, the Constant Pool, and method tables are kept in a nongarbage collected heap.
The second heap is split into two areas that grow in opposite directions. One area is used to hold object instances, and the other contains "handles" to those instances. The runtime image of fields and variables in your Java application that reference object instances do not actually contain pointers to those objects. They contain pointers to a special, fixed-size, heap-based memory object called a handle. The handle is a structure that contains two pointers: one to the object's method table and the other to the actual object instance. The advantage to this layout is that the handles never move in memory, so there is never a need to keep track of which variables point to which objects when updating pointers after compacting. You simply update the pointer value of the handle structure.
So , now, you can understand what is compil-time constant, what is runtime varible. In fact, in my understanding, the runtime varible is not a dynamic one since its handler can not be changed during the application lifecycle.
The above is just my view and just as reference, if there are wrong sections, plz point out.Thanks
regds
George
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic