Home / java / Class Loaders in Java

Class Loaders in Java

1 what is class loading ?
loding .class files into jvm is nothing but class loading.
Class loaders are responsible for loading .class files available
in hard disk into JVM.

2 Class loaders are three types::
1. Bootstrap loader.
2. Extension loader.
3. Class path or System loader.

• Bootstrap loader loads all .class files related to JAVA.
• Extension loader loads all .class files available in ext folders.
• Classpath loader loads all .class files available in classpath.
• The bootstrap loader cannot see the class related to ext and classpath
loaders.
• extension loader can see the classes related to ext and bootstrap.
• classpath loader can see the classes related to classpath, ext, bootstrap loaders.

 Dynamic class loading is possible by using Class.forname method.

//Bring .class files into ram.(class loading)
//Bring java s/w into ram.(bootstrap)
//bootstrap load loads the JVM into ram.
//Bring java related files into ram.
–How can u change param size?
–Before load apache how much memory require into ram?
3 is possible to create an object for class before static block?
Ans: Static method assigns into the static property. In that static method, we can create the object.
Public class TestExecution{
Private static int teststatic=testStatic();
Static{
s.o.p();
}
Public static int testStatic(){
s.o.p();
return 10;
}
Public static void main(){
s.o.p();
}
}


{
//instance block
}
Private string abc=getData();
Public string getData(){
Return “nnr”;
}

• Static methods are not going to execute automatically.
• Before static block we can execute static methods where intialize static variables we can call static methods to initialize static variable.

About Mohammad Fareed

Software Engineer @ Tekzenit.

Check Also

What is Mutable and Immutable ?

1.what is the Difference between String and StringBuffer? Ans: 1. The string is immutable whereas …

Leave a Reply

Your email address will not be published. Required fields are marked *