You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 16 |[What are the differences between arraylist and vector?](#what-are-the-differences-between-arraylist-and-vector)|
26
26
| 17 |[What is finalize method? How do you override it?](#what-is-finalize-method-how-do-you-override-it)|
27
27
| 18 |[What Is the Difference Between the Comparable and Comparator Interfaces](#what-is-the-difference-between-the-comparable-and-comparator-interfaces)|
JVM(Java Virtual Machine) is an abstract runtime engine to run java applications. It is part of Java Runtime Environment(JRE) to execute the bytecode generated by java compilers. JVM brings WORA(Write Once Read Anywhere) behavior in which you can write java program on one system and expected to run on any java enabled systems without any modifications. Upon compiling .java file to .class file(contains byte code), .class file goes into severl steps described by JVM.
61
+
JVM(Java Virtual Machine) is an abstract runtime engine to run java applications. It is part of Java Runtime Environment(JRE) to execute the bytecode generated by java compilers. JVM brings WORA(Write Once Read Anywhere) behavior in which you can write java program on one system and expected to run on any java enabled systems without any modifications. Upon compiling .java file to .class file(contains byte code), .class file goes into several steps described by JVM.
1.**Bootstrap ClassLoader:** This is a root class loader and typically represented as null. It loads the core java libraries located in <JAVA_HOME>/jmods folder like `java.lang`, `java.util` etc. This class loader is written in native code unlike other class loaders.
96
97
97
-
2.**Platform ClassLoader:** This class loader is responsible for loading platform classes such as Java SE platform APIs, their implementation classes and JDK-specific run-time classes. For example, the platform classess such as `java.net.http`, `java.sql`, `org.graalvm.compile`(JDK Specific).
98
+
2.**Platform ClassLoader:** This class loader is responsible for loading platform classes such as Java SE platform APIs, their implementation classes and JDK-specific run-time classes. For example, the platform classes such as `java.net.http`, `java.sql`, `org.graalvm.compile`(JDK Specific).
98
99
99
100
3.**System/Application classLoader:** This class loader is responsible for loading all the classes configured from the classpath. The classpath can contain classes from directories, JAR files etc.
5.**Garbage Collector:** Garbage Collector(GC) is responsible to collect and remove unreferenced objects from the heap area. This memory management feature is used to reclaim the unused memory and makes free space for newer objects. This happens in two phases:
151
152
152
153
1.**Mark:** In this step, GC identifies the unused objects in memory
153
-
2.**Sweep:** As part of this step, GC removes the objects indentified in the previous phase.
154
+
2.**Sweep:** As part of this step, GC removes the objects identified in the previous phase.
154
155
155
156
4.**Java Native Interface (JNI) :** JNI is used as a bridge between java method calls and native libraries written in C, C++ etc. Sometimes it is required to invoke native code for specific underlined hardeware.
156
157
5.**Native Method Libraries :** These are collection of native libraries(C/C++/Assembly) which are required by execution engine. These libraries loaded through JNI and represented in the form of `.dll` or `.so` files.
Whereas the exceptions which are not checked at compile time are known as unchecked excpetions. All the exceptions under Error and RuntimeException comes under unchecked exceptions.
337
+
Whereas the exceptions which are not checked at compile time are known as unchecked exceptions. All the exceptions under Error and RuntimeException comes under unchecked exceptions.
You can use `.valueOf` methods from wrapper classes to convert primitive to object type, and the same way wrapper class methods like `intValue`, `doubeValue` etc used to convert wrapper class to primitive type. But this manual process can be automated.
380
+
You can use `.valueOf` methods from wrapper classes to convert primitive to object type, and the same way wrapper class methods like `intValue`, `doubleValue` etc used to convert wrapper class to primitive type. But this manual process can be automated.
The comparator is a functional interfaceused to sort objects and it provides **multiple sorting sequence** in which objects sorted based on multiple data members. This interfaceis available as part of `java.util` package. For example, Employee object can be sorted based on multiple attributes like id, name, age etc.
You can create multiple separate classes (which implement Comparator interface) to compare by different members.TheComparator provides the compare() method which can be overriden to customize the comparison logic. For example, group of employees sorted based on id and age data members even though Employee classoverridden the compareTo method.
655
+
You can create multiple separate classes (which implement Comparator interface) to compare by different members.TheComparator provides the compare() method which can be overridden to customize the comparison logic. For example, group of employees sorted based on id and age data members even though Employee classoverridden the compareTo method.
0 commit comments