Architecture
- Introduction
- Overview
- Architecture
- Base System
- Getting Started
- Setting up IDE
- First Java Program
- Data Types
- Primitive Data Types
- Variables and Literals
- Variables
- Literals
- Operators
- Arithmetic Operators
- Increment and Decrement Operators
- Relational Operators
- Bitwise Operators
- Logical Operators
- Assignment Operators
- Control Flow
- Conditional Statements
- Loops
- Strings
- Forming Strings
- Substrings
- Concatenation
- Frequent operations on strings
- Building Strings
- Arrays
- Forming Arrays
- Accessing Array Elements
- Multidimensional Arrays
- Input and Output
- Reading Input
- File Input and Output
- Exceptions
- Cause of Exception
- Types of exception
- Exception Handling
- Throws & Throw Keywords
- User Defined Exceptions
- Logging
- Assertions
- Object Oriented Programming
- Introduction to Object-Oriented Programming
- Inheritance
- Overriding
- Polymorphism
- Abstraction
- Encapsulation
- Interfaces
When you run a Java program, it does not get directly executed by the Operating system, rather it is loaded and then executed by a Java Virtual Machine (JVM). Operating system compatible Java Runtime Environment (JRE) needs to be downloaded and installed in order to facilitate the execution of Java programs.
The following figure represents Java architecture:
We write the code in a form understandable by us (called the source code). Then compiles the code using compiler. The Compiler takes as input the source code and converts it into a form understandable by the Java virtual machine (JVM), i.e., byte code. This byte code is further converted into machine code by the JVM and executed by the execution engine to produce the desired output.
Details of the components of JVM:
- Class loader
The class loader subsystem is used for loading class files. Primary function is Loading, Linking and Initialization. - JVM Memory
a. Method Area
Class level information is stored here, like class name, parent class name, method and variable information.
b. Heap
Information of all the objects is stored here. Heap is created during JVM start-up.
c. JVM Language Stack
One runtime stack is created for every thread, which is stored here. Every block of the stack stores method call and all the local variable of that particular method are stored in its corresponding frame.
d. PC Register
It stores the address of the current execution instruction.
e. Native Method Stack
It stores the native method information. - Execution Engine
It executes the bytecode. - Native Method Interface
This provides interacts with the native method libraries and provides the native libraries for the execution. - Native Method Libraries
It is a collection of native method libraries (written in any other programming language other than Java).