Do static variables consume memory?? Since static blocks/variables are executed/loaded only at the first time the class is loaded, wiil they be loaded for the entire JVM lifetime or they will be accessed on the fly?? Thanx in advance.
posted 13 years ago
They are loaded on demand (when their containing class is used in some way), and then persist for the duration of the application.