SlideShare a Scribd company logo
Core Java

Debasish Pratihari

Hello world Program
File Name : Lakshya.java
class Lakshya
{
public static void main(String args[])
{
System.out.println(“Welcome to Lakshya..”);
}
}
To compile: javac Lakshya.java
To Run
: java Lakshya

Lakshya.java

Compilation

javac

Lakshya.class

Lecture/core/intro3/03

Source code

javac

Bytecode

Page #1

feel the Technology…
Core Java

Debasish Pratihari

Bytecode:


An architecture neutral intermediate format
designed to transport code efficiently to multiple
hardware and software.



Bytecode is the intermediate representation of
Java programs



A bytecode program is normally executed by
parsing the instructions one at a time.

To see the Bytecode:
Javap –c Lakshya
.class file
Compiled from "Lakshya.java"
name
class Lakshya extends java.lang.Object{
Lakshya();
Code:
0:
aload_0
1:
invokespecial
#1; //Method java/lang/Object."<init>":()V
4:
return
public static void main(java.lang.String[]);
Code:
0:
getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream;
3:
ldc
#3; //String Welcome to Lakshya..
5:
invokevirtual
#4; //Method
java/io/PrintStream.println:(Ljava/lang/String;)V
8: return
}
More about Bytecodes:








Bytecodes are the machine language of the JVM.
There is one stream of Bytecodes for each method in
the class.
The Bytecodes are stored in the method area of JVM.
The Bytecodes for a method are executed when that
method is invoked.
A Bytecode stream is a sequence of instruction for
JVM.
Each instruction consist of one-byte opcode followed
by zero or more operands.
Bytecodes can be executed by interpretation or by
Just-In-Time compiler.

Lecture/core/intro3/03

Page #2

feel the Technology…
Core Java

Debasish Pratihari

Java Program Execution:



A JVM starts up by loading a specified class and
then invoking the main method from the
specified class, providing it a single parameter
of array of string.



A class must be initialize before it can be
invoked.



A class must be linked before it initialized.

Linking:
 Verification
 Well-formed
 Proper Symbol Table
 semantics
 Preparation
 Allocation of Static Storage
 Create data structures required By
JVM
 Resolution
 it is the process of checking
symbolic references from a class to
other classes and interface
Initialize:



Class variables initalizers and static initalizers are
executed.
Before a class gets initializes its direct super class
must be initialized.

Loading of Classes and Interfaces:



Loading refers to the process of finding the binary
form of a class or interface.
The loading process is implemented by the class
ClassLoader.

Lecture/core/intro3/03

Page #3

feel the Technology…
Core Java

Debasish Pratihari

Introduction to JVM






It is a machine out of software and exits in
computer memory.
It is responsible to convert Java Bytecodes to
native code and execute it.
A runtime instance of the JVM runs one java
application.
Every java application need a separate JVM for
their execution.
The JVM instance dies after execution of a Java
program.

How JVM Works :
25%

Inside view of JVM :

Lecture/core/intro3/03

Page #4

feel the Technology…
Core Java

Debasish Pratihari

JVM Platforms:
IA-64
(Itanium)

IA-32

Win 32

Linux
X86

OS/2

S/390

Power/PowerPC

AIX

OS/400

Linux
PPC

Linux
IA-64

Win 64

Linux
390

OS/39j

Just-In-Time(JIT) Compiler:


The Just-In-Time compiler is a component of
Java Run-Time environment. It improves the
performance of Java applications by compiling
bytecodes to native machine code at run-time.



It is also referred as dynamic compilation



It can be disable by passing JVM parameter
o

Java –Djava.compiler=NONE Test

Java Run-Time Enviro nme nt

Class Lo ader Bytecode
Verifier

Java C lass
Lib raries

ByteCodes

Java
Interp reter

Just-in-time
Co mpiler

Runtime S ystem

Operating S ystem
Hard ware

Lecture/core/intro3/03

Page #5

feel the Technology…

More Related Content

PPTX
Java architecture
PPTX
Java virtual machine
PPTX
Jvm Architecture
PDF
What is-java
PPTX
Jdk,jre,jvm
DOCX
JDK,JRE,JVM
PPTX
Architecture diagram of jvm
Java architecture
Java virtual machine
Jvm Architecture
What is-java
Jdk,jre,jvm
JDK,JRE,JVM
Architecture diagram of jvm

What's hot (20)

PPT
CS Lesson: Introduction to the Java virtual Machine
PPTX
History of java'
PPT
Java Virtual Machine
PPT
1 Introduction To Java Technology
PDF
Learn Java Part 1
PPT
JVM- Java Virtual Machine
PPTX
Java byte code presentation
PPTX
QSpiders - Jdk Jvm Jre and Jit
PPTX
Features of JAVA Programming Language.
PPTX
Introduction to Java Programming
PPT
Basics of java programming language
PPT
Fundamentals of JAVA
PPTX
Advance Java Topics (J2EE)
PDF
Introduction to java technology
PPTX
Java byte code & virtual machine
DOCX
Java and its features
PPT
Chapter 1 introduction to java technology
PPTX
Basics of JAVA programming
PDF
Java unit 1
CS Lesson: Introduction to the Java virtual Machine
History of java'
Java Virtual Machine
1 Introduction To Java Technology
Learn Java Part 1
JVM- Java Virtual Machine
Java byte code presentation
QSpiders - Jdk Jvm Jre and Jit
Features of JAVA Programming Language.
Introduction to Java Programming
Basics of java programming language
Fundamentals of JAVA
Advance Java Topics (J2EE)
Introduction to java technology
Java byte code & virtual machine
Java and its features
Chapter 1 introduction to java technology
Basics of JAVA programming
Java unit 1
Ad

Viewers also liked (20)

PDF
ZIP
Diigo Presentation- Revised
PPS
Pedalando - 09.12.07
PPTX
Collaboration for successful e-learning in Worcestershire
PDF
¡Basta de escuchar a los usuarios!
PPT
Ashcroft convent presentation to council committee
PPS
Niver Aposan - 2007
PPT
Ruhri Lukas The I Phone 1
KEY
Presentatie 2 Maart
PPTX
Itslearning presentation
PPT
The New Age Of Innovation
PPS
Niver Flavia - 26.08.07
PPS
Acampa2007
PPTX
Developing Policy for Emerging Technologies
KEY
Lecture somerset webversie
PPT
香港六合彩
PPT
Blog Ict 1
PDF
E Marketing To Small Businesses 101
PPT
Una Decena
Diigo Presentation- Revised
Pedalando - 09.12.07
Collaboration for successful e-learning in Worcestershire
¡Basta de escuchar a los usuarios!
Ashcroft convent presentation to council committee
Niver Aposan - 2007
Ruhri Lukas The I Phone 1
Presentatie 2 Maart
Itslearning presentation
The New Age Of Innovation
Niver Flavia - 26.08.07
Acampa2007
Developing Policy for Emerging Technologies
Lecture somerset webversie
香港六合彩
Blog Ict 1
E Marketing To Small Businesses 101
Una Decena
Ad

Similar to Lecture 3 (20)

PPT
A begineers guide of JAVA - Getting Started
PDF
Java Virtual Machine - Internal Architecture
PPT
Object Oriented Programming-JAVA
PPTX
JVMkhushi[1].pptx JVMkhushi[1].pptxJVMkhushi[1].pptx
PPTX
Java-1st.pptx about Java technology before oops
PPTX
2 22CA026_Advance Java Programming_Data types and Operators.pptx
PPTX
1.introduction to java
PDF
Java programming material for beginners by Nithin, VVCE, Mysuru
PDF
JAVA for Every one
PDF
Java Programming Fundamentals: Complete Guide for Beginners
PDF
OOPS JAVA.pdf
PPTX
Java Basic PART I
PPTX
JAVA ARCHITECTURES PPT | "Mastering Java: A Comprehensive Guide to Core Conc...
PPTX
JAVA ARCHITECTURES PPT | "Mastering Java: A Comprehensive Guide to Core Conc...
PDF
JAVA Program Examples
PDF
Top 10 Important Core Java Interview questions and answers.pdf
DOCX
Java JDK.docx
PDF
Javanotes ww8
A begineers guide of JAVA - Getting Started
Java Virtual Machine - Internal Architecture
Object Oriented Programming-JAVA
JVMkhushi[1].pptx JVMkhushi[1].pptxJVMkhushi[1].pptx
Java-1st.pptx about Java technology before oops
2 22CA026_Advance Java Programming_Data types and Operators.pptx
1.introduction to java
Java programming material for beginners by Nithin, VVCE, Mysuru
JAVA for Every one
Java Programming Fundamentals: Complete Guide for Beginners
OOPS JAVA.pdf
Java Basic PART I
JAVA ARCHITECTURES PPT | "Mastering Java: A Comprehensive Guide to Core Conc...
JAVA ARCHITECTURES PPT | "Mastering Java: A Comprehensive Guide to Core Conc...
JAVA Program Examples
Top 10 Important Core Java Interview questions and answers.pdf
Java JDK.docx
Javanotes ww8

More from Debasish Pratihari (19)

PDF
Lecture 24
PDF
Lecture 23
PDF
Lecture 22
PDF
Lecture 21
PDF
Lecture 20
PDF
Lecture 19
PDF
Lecture 18
PDF
Lecture 17
PDF
Lecture 16
PDF
Lecture 14
PDF
Lecture 10
PDF
PDF
PDF
PDF
PDF
PDF
PDF
PDF

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
Building Integrated photovoltaic BIPV_UPV.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Advanced methodologies resolving dimensionality complications for autism neur...
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Lecture 3

  • 1. Core Java Debasish Pratihari Hello world Program File Name : Lakshya.java class Lakshya { public static void main(String args[]) { System.out.println(“Welcome to Lakshya..”); } } To compile: javac Lakshya.java To Run : java Lakshya Lakshya.java Compilation javac Lakshya.class Lecture/core/intro3/03 Source code javac Bytecode Page #1 feel the Technology…
  • 2. Core Java Debasish Pratihari Bytecode:  An architecture neutral intermediate format designed to transport code efficiently to multiple hardware and software.  Bytecode is the intermediate representation of Java programs  A bytecode program is normally executed by parsing the instructions one at a time. To see the Bytecode: Javap –c Lakshya .class file Compiled from "Lakshya.java" name class Lakshya extends java.lang.Object{ Lakshya(); Code: 0: aload_0 1: invokespecial #1; //Method java/lang/Object."<init>":()V 4: return public static void main(java.lang.String[]); Code: 0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3; //String Welcome to Lakshya.. 5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: return } More about Bytecodes:        Bytecodes are the machine language of the JVM. There is one stream of Bytecodes for each method in the class. The Bytecodes are stored in the method area of JVM. The Bytecodes for a method are executed when that method is invoked. A Bytecode stream is a sequence of instruction for JVM. Each instruction consist of one-byte opcode followed by zero or more operands. Bytecodes can be executed by interpretation or by Just-In-Time compiler. Lecture/core/intro3/03 Page #2 feel the Technology…
  • 3. Core Java Debasish Pratihari Java Program Execution:  A JVM starts up by loading a specified class and then invoking the main method from the specified class, providing it a single parameter of array of string.  A class must be initialize before it can be invoked.  A class must be linked before it initialized. Linking:  Verification  Well-formed  Proper Symbol Table  semantics  Preparation  Allocation of Static Storage  Create data structures required By JVM  Resolution  it is the process of checking symbolic references from a class to other classes and interface Initialize:   Class variables initalizers and static initalizers are executed. Before a class gets initializes its direct super class must be initialized. Loading of Classes and Interfaces:   Loading refers to the process of finding the binary form of a class or interface. The loading process is implemented by the class ClassLoader. Lecture/core/intro3/03 Page #3 feel the Technology…
  • 4. Core Java Debasish Pratihari Introduction to JVM      It is a machine out of software and exits in computer memory. It is responsible to convert Java Bytecodes to native code and execute it. A runtime instance of the JVM runs one java application. Every java application need a separate JVM for their execution. The JVM instance dies after execution of a Java program. How JVM Works : 25% Inside view of JVM : Lecture/core/intro3/03 Page #4 feel the Technology…
  • 5. Core Java Debasish Pratihari JVM Platforms: IA-64 (Itanium) IA-32 Win 32 Linux X86 OS/2 S/390 Power/PowerPC AIX OS/400 Linux PPC Linux IA-64 Win 64 Linux 390 OS/39j Just-In-Time(JIT) Compiler:  The Just-In-Time compiler is a component of Java Run-Time environment. It improves the performance of Java applications by compiling bytecodes to native machine code at run-time.  It is also referred as dynamic compilation  It can be disable by passing JVM parameter o Java –Djava.compiler=NONE Test Java Run-Time Enviro nme nt Class Lo ader Bytecode Verifier Java C lass Lib raries ByteCodes Java Interp reter Just-in-time Co mpiler Runtime S ystem Operating S ystem Hard ware Lecture/core/intro3/03 Page #5 feel the Technology…