Java Concepts

Ace your homework & exams now with Quizwiz!

What is Initialization in JVM?

1) It involves executing its class or interface initialization method or calling the class's constructor for example. 2) Initialization of a class or interface requires careful synchronization because the JVM is multithreaded 3) This is the final phase of Class Loading, here all static variables will be assigned with the original values, and the static block will be executed.

What is Java and what are the advantages?

1) Java is an object oriented programming language which helps developers to create standalone, mobile, enterprise and distributed application. 2) It is a platform independent language through "write once, run anywhere" concept. 3) It is simple, reliable, secured and easy to use. 4) It has strong memory management.

Execution of Java Program?

1) We write Java source Code into .java file 2) Program has to be compiled through Java Compiler (javac) which converts into .class file in form of Java Byte Codes. 3) This class file can be executed in any platform/OS by JVM (Java virtual machine). 4) JVM translates byte code into native machine code which machines can execute.

What is Thread?

A thread is an independent path of execution within a program. Many threads can run concurrently within a program. Every thread in Java is created and controlled by the java.lang.Thread class. A Java program can have many threads, and these threads can run concurrently, either asynchronously or synchronously.

What is garbage collection?

Garbage collection is a process of reclaiming the runtime unused objects. It is performed for memory management.

What is Heap in Memory Area?

Heap stores all objects that are created during application execution.

What is Preparation in JVM Linking?

It involves creating the static fields for a class or an Interface with their default values.

What is Native Method Libraries?

It is a collection of the Native Libraries which is required for the Execution Engine.

What is Resolution in JVM Linking?

It is the process of locating classes, interfaces, fields, and methods referenced symbolically from a type's constant pool, and replacing those symbolic references with direct references.

What is Bootstrap ClassLoader in JVM Loading?

It loads JDK internal classes, typically loads rt.jar and other core classes for example like java.lang, java.net, java.util, java.io package classes.

What is Extension ClassLoader in JVM Loading?

It loads classes from the JDK extensions directory, usually lib/ext directory of the JRE.

What does "write once, run everywhere" means? and how can it make Java platform independent?

It means that compiled Java code can run on all platforms that support Java without the need for recompilation. For example, you can write and compile a Java program on UNIX and run it on Microsoft Windows, Macintosh, or UNIX machine without any modifications to the source code. WORA is achieved by compiling a Java program into an intermediate language called bytecode. The format of bytecode is platform-independent. A virtual machine, called the Java Virtual Machine (JVM), is used to run the bytecode on each platform.

What is JDK?

JDK is a Java Development Kit and it contains JRE as well as development tools for developing, debugging, and monitoring Java applications.

What is JRE?

JRE is a Java Runtime Environment. It contains set of libraries + other files that JVM uses at runtime.

What is JVM

JVM is a Java Virtual Machine. It is an abstract machine where you can load, verifies, execute your program.

Explain JVM Architecture?

JVM needs .class as an input to process. This .class file contains Java Byte Code for JVM and is generated by a Java compiler(javac.exe) JVM has three main layers 1) Class Loader 2) Memory Area 3) Execution Engine

What is JNI?

Java Native Interface will be interacting with the Native Method Libraries and provides the Native Libraries required for the Execution Engine.

What is Native Method Stack?

Java supports and uses native code as well. Many low level code is written in languages like C and C++. Native method stacks hold the instruction of native code.

What is Linking in JVM?

Linking a class or interface involves 'verifying' and 'preparing' that class or interface, its direct superclass, its direct super interfaces, arrays. 'Resolution' of symbolic references in the class or interface is an optional part of linking. 1) Verification 2) Preparation 3) Resolution

What is System ClassLoader in JVM Loading?

Loads classes from system classpath, that can be set while invoking a program using -cp or -classpath command line options.

What is Memory Area in JVM?

Memory area inside JVM is divided into multiple parts to store specific parts of application data. It performs five functions 1) Method Area 2) Heap 3) Stack 4) PC Register 5) Native Method Stack

What is Method Area in Memory Area?

Method Area stores class structures like metadata, the constant runtime pool, and the code for methods.

What is PC Register in Memory Area?

PC register store the physical memory address of the statements which is currently executing. In Java, each thread has its separate PC register.

What is Stack in Memory Area?

Stacks store local variables, and intermediate results. All such variables are local to the thread by which they are created. Each thread has its own JVM stack, created simultaneously as the thread is created. So all such local variable are called thread-local variables.

What is JIT compiler?

The JIT Compiler neutralizes the disadvantage of the interpreter. The Execution Engine will be using the help of the interpreter in converting byte code, but when it finds repeated code it uses the JIT compiler, which compiles the entire byte code and changes it to native code. This native code will be used directly for repeated method calls, which improve the performance of the system.

What is Execution Engine in JVM?

The byte code which is assigned to the Runtime Data Area will be executed by the Execution Engine. The Execution Engine reads the byte code and executes it piece by piece.

What is Class Loader in JVM?

The class loader is a subsystem used for loading class files. It performs three major functions 1) Loading 2) Linking 3) Initialization.

What is Interpreter?

The interpreter interprets the byte code faster, but executes slowly. The disadvantage of the interpreter is that when one method is called multiple times, every time a new interpretation is required.

What is Loading in JVM?

There are three kinds of Loading 1) Bootstrap Class Loader 2) Extensions Class Loader 3) System Class Loader

What is Verification in JVM Linking?

Verifies that the binary representation of class/Interface is structurally correct else an instance of LinkageError or its subclass is thrown.


Related study sets

Chapter 27: Management of Patients with Coronary Vascular Disorders - ML4

View Set

IT1510 Users and Groups Practice Quiz

View Set

Win Server Test Chapters 1 - 9 Final Exam

View Set

Chapter 1 - Leading Edge Management

View Set

Structural Units of The Human Body

View Set

Chapter 5: The Lipids; Triglycerides, Phospholipids, and Sterols

View Set