This week's giveaway is in the Cloud/Virtualization forum. We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line! See this thread for details.
It seems a class is loaded only once as long as a single class loader is used. I found this info at link
Once a class is loaded into a JVM, the same class (I repeat, the same class) will not be loaded again. This leads to the question of what is meant by "the same class." Similar to the condition that an object has a specific state, an identity, and that an object is always associated with its code (class), a class loaded into a JVM also has a specific identity, which we'll look at now.
In Java, a class is identified by its fully qualified class name. The fully qualified class name consists of the package name and the class name. But a class is uniquely identified in a JVM using its fully qualified class name along with the instance of the ClassLoader that loaded the class. Thus, if a class named Cl in the package Pg is loaded by an instance kl1 of the class loader KlassLoader, the class instance of C1, i.e. C1.class is keyed in the JVM as (Cl, Pg, kl1). This means that the two class loader instances (Cl, Pg, kl1) and (Cl, Pg, kl2) are not one and the same, and classes loaded by them are also completely different and not type-compatible to each other. How many class loader instances do we have in a JVM? The next section explains this.
Thanks & Regards,
posted 9 years ago
Thanks Srikanth , that was helpful ...
class will be loaded only once per classloader ! Rite