Java Basics Flashcards
What is the difference between JDK & JRE
JDK stands for Java Development Kit. It provides all the tools and libraries for the development of Java applications. JDK also contains compilers and debuggers. JRE stands for Java Runtime Environment, it is included in the JDK. It provides libraries and the Java Virtual Machine that is required to run a Java program.
What is the JVM?
Java Virtual Machine is an abstract machine that executes Java Bytecode. There are different JVM’s available for different platforms, so JVM is platform dependant. JVM loads, verifies and executes Java Bytecode. Most popular JVM is HotSpot from Oracle.
What are the different memory areas allocated by JVM?
Classloader, Class (Method) Area, Heap, Stack, Native Method Stack.
What is the Classloader?
It is a component of JVM used to load class files.
What is Class (Method) Area?
It stores per-class structures such as the runtime constant pool, field and method data, and the code for methods.
What is the Heap?
Memory that is created at runtime and it contains the runtime data area in which objects are allocated.
What is the Stack?
Stack stores local variables and partial results at runtime.
What is the Native Method Stack?
The area is reserved for all the native methods used in the application.
What is write once run anywhere?
Java is a platform independent library. Byte code generated by Java compiler can be interpreted by any JVm. Java compiler javac compiles java code and JVM runs that code.
What are the different Classloaders?
Bootstrap, Extension and Application
What is the Bootstrap Classloader?
The bootstrap Classloader loads all the classes from the rt.jar file.
What is the Extension Classloaders?
It loads class files from jre/lib/ext location.
What is the Application Classloader?
This Classloader depends on the CLASSPATH to find the locations of class files.
If we do not specify a value for local variables, what will be their default value?
Java does not initialise variables with a default value. So it will be null.