15CSE202 Object Oriented Programming: Overview of JDK
15CSE202 Object Oriented Programming: Overview of JDK
Overview of JDK
Nalinadevi Kadiresan
CSE Dept.
Amrita School of Engg.
15CSE202 Object oriented Programming 2
HelloWorld Program
public class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
} • Save this file as HelloWorld.java
• To compile: javac HelloWorld.java
• To execute: java HelloWorld
• Output: Hello world
javac HelloWorld.java
HelloWorld.java
compile
source code
HelloWorld.class
bytecode
java HelloWorld
run
June 2019 Nalinadevi Kadiresan
15CSE202 Object oriented Programming 5
JavaSE/JDK
• Before you can develop an application written in the Java
programming language, you will need the
Java Platform Standard Edition (Java SE) development kit.
Java SE/JDK
Java SE/JDK
• JDK consists of Java Runtime Environment(JRE) +
compiler, debuggers
JRE
JRE
Java Runtime Environment(JRE):
• It is used to provide runtime environment.
• It is the implementation of JVM.
• It physically exists.
• It contains set of libraries + other files that JVM uses
at runtime.
15CSE202 Object oriented Programming
JVM
JVM (Java Virtual Machine) is an abstract machine. It is a specification that
provides runtime environment in which java bytecode can be executed.
JVMs are available for many hardware and software platforms. JVM, JRE and
JDK are platform dependent because configuration of each OS differs. But,
Java is platform independent.
JVM
Java program at run time
Classloader: is the subsystem of JVM that
is used to load class files.
JVM Architecture
JVM Architecture
1. Class Loader: The class loader is a subsystem used for loading class files. It
performs three major functions viz. Loading, Linking, and Initialization.
2. Method Area: JVM Method Area stores class structures like metadata, the
constant runtime pool, and the code for methods.
3. Heap: All the Objects, their related instance variables, and arrays are stored in
the heap. This memory is common and shared across multiple threads.
4. JVM language Stacks: Java language Stacks store local variables, and it’s
partial results. Each thread has its own JVM stack, created simultaneously as
the thread is created. A new frame is created whenever a method is invoked,
and it is deleted when method invocation process is complete.
5. PC Registers: PC register store the address of the Java virtual machine
instruction which is currently executing. In Java, each thread has its separate
PC register.
JVM Architecture
5. Native Method Stacks: Native method stacks hold the instruction of
native code depends on the native library. It is written in another
language instead of Java.
6. Execution Engine: It is a type of software used to test hardware,
software, or complete systems. The test execution engine never carries
any information about the tested product.
7. Native Method interface: The Native Method Interface is a
programming framework. It allows Java code which is running in a JVM
to call by libraries and native applications.
8. Native Method Libraries: Native Libraries is a collection of the Native
Libraries(C, C++) which are needed by the Execution Engine.
Java vs Python
Java Python
Java is a compiled language Python is a interpreted language
Java vs Python
• Choosing which language to goes with depends on
your company’s needs, and which setbacks you’re
willing to accept.
Java vs Python
Courtesy: https://stackify.com/java-vs-python/
https://www.edureka.co/blog/java-vs-python/
Supplemental reading
• Getting Started
http://java.sun.com/docs/books/tutorial/getStarted/index.html
http://developer.java.sun.com/developer/onlineTraining/Programming/
BasicJava1/compile.html
15CSE202 Object oriented Programming 26