Could someone explain what is the difference between Class loading and instantiating a Class. When we load a class with Static variable does it also get instantiated the same ti
Class loader actually loads byte code into JVM , runs static initializers.When you want to use static fields within class without creating instance of it ,class must be loaded by class loader first.Default classloader in java is java.lang.ClassLoader
.This class loading is done only once.
While class instantiation is creating instance of class into memory.We can instantiate class using new
.Class instantiation can be done as many times.
eg: Animal a=new Animal();
More on class loading