Forums Register Login

how the execution happens?

+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
I didn't dig deep into this, but it's probably because of a compiler optimization: the variables S in class V and I in class X are compile-time constants, so in your main() method the compiler replaces "V.S" and "X.I" by the values of the constants - and so classes X and V don't need to be loaded anymore.
+Pie Number of slices to send: Send
I think that's what Tony was hinting in another post. That bothers me though. What if a third party changes the value of V.S and I plug in a new jar but don't recompile? I'll miss the change?
+Pie Number of slices to send: Send
 

Originally posted by Stan James:
I'll miss the change?



Yep. Therefore changing the value of a public static final field is not something to take lightly.
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 866 times.
Similar Threads
When a final is not a constant
HELP~~
Random string generation
Super and sub class
Declare and use interface
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:21:00.