| Author |
Compile Time Constant
|
Prashanth Lingala
Ranch Hand
Joined: Nov 13, 2004
Posts: 66
|
|
What do you exactly mean by stating that a field is a compile time constant Please explain ???
|
Have A Nice Day !!!
|
 |
Lamont Williams
Greenhorn
Joined: Apr 28, 2004
Posts: 2
|
|
Here is some info I found that should be helpful. A compile-time constant is a value that can be (and is) computed at compile-time. A runtime constant is a value that is computed only while the program is running. If you run the same program more than once: A compile-time constant will have the same value each time the application is run. A runtime constant can have a different value each time the application is run.
|
 |
Prashanth Lingala
Ranch Hand
Joined: Nov 13, 2004
Posts: 66
|
|
Thank You Very Much Regards Prashanth Lingala
|
 |
James Carman
Ranch Hand
Joined: Feb 20, 2001
Posts: 580
|
|
Maybe you encountered the term when you read that there is a big-time gotcha with respect to compile-time constants. Consider the following scenario... Now, if you compile these two java files and run class B, it will print out, "Hello". If you then change the "MESSAGE" variable in A.java to "Hello, World", compile A.java, and then run class B again, it'll print "Hello" still! It will not lookup the value of the "MESSAGE" variable dynamically at runtime. So, be careful. It helps if you use an IDE which keeps track of that stuff and knows that B needs to be recompiled because one of its dependencies has changed. [ March 08, 2005: Message edited by: James Carman ]
|
James Carman, President<br />Carman Consulting, Inc.
|
 |
 |
|
|
subject: Compile Time Constant
|
|
|