1

How JVM managing internally

  1. If load same version of class loads in two different user defined class loader?

2 . If load different version of class loads in two different user defined class loader (same class name and package). If JVM loads both classes which will be referred in my application.

We know JVM loads the class in the combination of class, package & Klass loader.

I want to know how internally JVM handle these situations.

2 Answers2

0

Inside a JVM instance, information about loaded types is stored in a logical area of memory called the method area. For each type it loads, JVM stores the different type of information in the method area including: • The fully qualified name of the type • Whether or not the type is a class or an interface • A reference to class ClassLoader – information about the classloader used to load this type

Har Krishan
  • 273
  • 1
  • 11
0

JVM treats them as different classes. The metadata of different classloaders is isolated, so it does not matter whether the classes have the same name or not.

Each ClassLoader has its own Metachunk to store class metadata.

apangin
  • 92,924
  • 10
  • 193
  • 247