Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 092d10f

Browse files
Update README.md
1 parent 2ac3fd0 commit 092d10f

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

‎README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,41 +2469,37 @@ private final int x = 10;
24692469
24702470
## Q. How bootstrap class loader works in java?
24712471
2472+
Bootstrap ClassLoader is repsonsible for loading standard JDK classs files from **rt.jar** and it is parent of all class loaders in java. There are three types of built-in ClassLoader in Java:
24722473
2473-
Bootstrap **ClassLoader** is repsonsible for loading standard JDK classs files from **rt.jar** and it is parent of all class loaders in java.
2474-
There are three types of built-in ClassLoader in Java:
2474+
**1. Bootstrap Class Loader:** It loads JDK internal classes, typically loads rt.jar and other core classes for example java.lang.* package classes
24752475
2476-
**1. Bootstrap Class Loader** It loads JDK internal classes, typically loads rt.jar and other core classes for example java.lang.* package classes
2476+
**2. Extensions Class Loader:** It loads classes from the JDK extensions directory, usually $JAVA_HOME/lib/ext directory.
24772477
2478-
**2. Extensions Class Loader** – It loads classes from the JDK extensions directory, usually $JAVA_HOME/lib/ext directory.
2479-
2480-
**3. System Class Loader** – It loads classes from the current classpath that can be set while invoking a program using -cp or -classpath command line options.
2478+
**3. System Class Loader:** It loads classes from the current classpath that can be set while invoking a program using -cp or -classpath command line options.
24812479
24822480
```java
2481+
/**
2482+
* ClassLoader
2483+
*/
24832484
import java.util.logging.Level;
24842485
import java.util.logging.Logger;
24852486
2486-
/**
2487-
* Java program to demonstrate How ClassLoader works in Java
2488-
*
2489-
**/
2490-
24912487
public class ClassLoaderTest {
2492-
2488+
24932489
public static void main(String args[]) {
2494-
try {
2495-
//printing ClassLoader of this class
2496-
System.out.println("ClassLoader : "+ ClassLoaderTest.class.getClassLoader());
2490+
try {
2491+
//printing ClassLoader of this class
2492+
System.out.println("ClassLoader : "+ ClassLoaderTest.class.getClassLoader());
24972493
2498-
//trying to explicitly load this class again using Extension class loader
2499-
Class.forName("Explicitly load class", true
2500-
, ClassLoaderTest.class.getClassLoader().getParent());
2494+
// trying to explicitly load this class again using Extension class loader
2495+
Class.forName("Explicitly load class", true, ClassLoaderTest.class.getClassLoader().getParent());
25012496
} catch (ClassNotFoundException ex) {
25022497
Logger.getLogger(ClassLoaderTest.class.getName()).log(Level.SEVERE, null, ex);
25032498
}
25042499
}
25052500
}
25062501
```
2502+
25072503
<div align="right">
25082504
<b><a href="#related-interview-questions">↥ back to top</a></b>
25092505
</div>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /