SlideShare a Scribd company logo
1 of 15
Java Virtual Machine
and
Runtime Environment
Basic Concept
 When you write a program in C++ it is known as
source code.
 The C++ compiler converts this source code into the
machine code of underlying system (e.g. Windows)
 If you want to run that code on Linux you need to
recompile it with a Linux based compiler.
 Due to the difference in compilers, sometimes you
need to modify your code.
The Concept of WORA
 Java introduced WORA: Write Once Run Anywhere
 When you write a java program it is known as the source code of
java.
 The java compiler compiles this source code for a software system
known as JVM
 This compiled code is known as ‘Byte Code’
 We have different JVMs for different systems (such as JVM for
Windows , JVM for Linux etc).
 When we run our program the JVM interprets translates) the
compiled program into the language understood by the underlying
system.
 So we write our code once and the JVM runs it everywhere
according to the underlying system.
Byte Code
 Java programs (Source code) are compiled
into a form called Java bytecodes.
 The Java compiler reads Java language
source (.java) files, translates the source into
Java bytecodes, and places the bytecodes
into class (.class) files.
 The compiler generates one class file for
each class contained in java source file.
Java Virtual Machine
 The central part of java platform is java virtual
machine
 Java bytecode executes by special software known
as a "virtual machine".
 Most programming languages compile source code
directly into machine code, suitable for execution
 The difference with Java is that it uses bytecode - a
special type of machine code.
 The JVM executes Java bytecodes, so Java
bytecodes can be thought of as the machine
language of the JVM.
Java Virtual Machine
Java Runtime Environment(JRE)
 The Java Virtual Machine is a part of a large
system i.e. Java Runtime Environment(JRE).
 Each operating system and CPU architecture
requires different JRE.
 The JRE consists of set of built- in classes,
as well as a JVM.
 Without an available JRE for a given
environment, it is impossible to run Java
software.
Java Runtime Environment
First Java Program
Data Types
 The Java programming language is strongly-typed, which
means that all variables must first be declared before they can
be used.
int gear = 1;
 The eight primitive data types supported by the Java
programming language are:
– int, byte, short, long, float, double, boolean, char
Naming Conventions
 Java uses identifiers to name
– variables
– methods
– classes
– packages
 Syntax rules
– Must begin with a letter (upper- or lower-case)
– May be followed by any number (including 0) of letters and
digits
– The characters $ and _ are considered letters
– Java identifier names are case sensitive
– May not duplicate a Java keyword (e.g. class or main)
Escape Sequence
Control Structures
 Loops: for, while, do while
 If, if else, if else if, switch case
Class and object
 Class is a user defined data type.
 Object is variable of a class
– Data Members and Methods
 Constructor
 Method Overloading
 Inheritance
 Method Overriding

More Related Content

What's hot

Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvmhome
 
Basic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java courseBasic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java coursePreeti Agarwal
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMshamnasain
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecturesubnesh
 
CS Lesson: Introduction to the Java virtual Machine
CS Lesson: Introduction to the Java virtual MachineCS Lesson: Introduction to the Java virtual Machine
CS Lesson: Introduction to the Java virtual MachineKatrin Becker
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machineLaxman Puri
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classesyoavwix
 
Java compilation
Java compilationJava compilation
Java compilationMike Kucera
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)Jadavsejal
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924yohanbeschi
 

What's hot (20)

Jdk,jre,jvm
Jdk,jre,jvmJdk,jre,jvm
Jdk,jre,jvm
 
Java Virtual Machine
Java Virtual MachineJava Virtual Machine
Java Virtual Machine
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
JVM
JVMJVM
JVM
 
Basic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java courseBasic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java course
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecture
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
JVM
JVMJVM
JVM
 
CS Lesson: Introduction to the Java virtual Machine
CS Lesson: Introduction to the Java virtual MachineCS Lesson: Introduction to the Java virtual Machine
CS Lesson: Introduction to the Java virtual Machine
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
 
Java compilation
Java compilationJava compilation
Java compilation
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)
 
QSpiders - Memory (JVM architecture)
QSpiders - Memory (JVM architecture)QSpiders - Memory (JVM architecture)
QSpiders - Memory (JVM architecture)
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Java Class1
Java Class1Java Class1
Java Class1
 
QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 

Similar to JVM Runtime and Bytecode (20)

java intro.pptx
java intro.pptxjava intro.pptx
java intro.pptx
 
JVM.pptx
JVM.pptxJVM.pptx
JVM.pptx
 
What is java
What is javaWhat is java
What is java
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
Java unit 1
Java unit 1Java unit 1
Java unit 1
 
Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
 
Java notes
Java notesJava notes
Java notes
 
Java JDK.docx
Java JDK.docxJava JDK.docx
Java JDK.docx
 
Unit1 JAVA.pptx
Unit1 JAVA.pptxUnit1 JAVA.pptx
Unit1 JAVA.pptx
 
Basic Java I
Basic Java IBasic Java I
Basic Java I
 
Android Training Chandigarh
Android Training ChandigarhAndroid Training Chandigarh
Android Training Chandigarh
 
Java introduction
Java introductionJava introduction
Java introduction
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVA
 
Ijaprr vol1-2-13-60-64tejinder
Ijaprr vol1-2-13-60-64tejinderIjaprr vol1-2-13-60-64tejinder
Ijaprr vol1-2-13-60-64tejinder
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
 
java basics.pptx
java basics.pptxjava basics.pptx
java basics.pptx
 
JAVA for Every one
JAVA for Every oneJAVA for Every one
JAVA for Every one
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Java lab zero lecture
Java  lab  zero lectureJava  lab  zero lecture
Java lab zero lecture
 

Recently uploaded

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 

Recently uploaded (20)

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 

JVM Runtime and Bytecode

  • 2. Basic Concept  When you write a program in C++ it is known as source code.  The C++ compiler converts this source code into the machine code of underlying system (e.g. Windows)  If you want to run that code on Linux you need to recompile it with a Linux based compiler.  Due to the difference in compilers, sometimes you need to modify your code.
  • 3. The Concept of WORA  Java introduced WORA: Write Once Run Anywhere  When you write a java program it is known as the source code of java.  The java compiler compiles this source code for a software system known as JVM  This compiled code is known as ‘Byte Code’  We have different JVMs for different systems (such as JVM for Windows , JVM for Linux etc).  When we run our program the JVM interprets translates) the compiled program into the language understood by the underlying system.  So we write our code once and the JVM runs it everywhere according to the underlying system.
  • 4.
  • 5. Byte Code  Java programs (Source code) are compiled into a form called Java bytecodes.  The Java compiler reads Java language source (.java) files, translates the source into Java bytecodes, and places the bytecodes into class (.class) files.  The compiler generates one class file for each class contained in java source file.
  • 6. Java Virtual Machine  The central part of java platform is java virtual machine  Java bytecode executes by special software known as a "virtual machine".  Most programming languages compile source code directly into machine code, suitable for execution  The difference with Java is that it uses bytecode - a special type of machine code.  The JVM executes Java bytecodes, so Java bytecodes can be thought of as the machine language of the JVM.
  • 8. Java Runtime Environment(JRE)  The Java Virtual Machine is a part of a large system i.e. Java Runtime Environment(JRE).  Each operating system and CPU architecture requires different JRE.  The JRE consists of set of built- in classes, as well as a JVM.  Without an available JRE for a given environment, it is impossible to run Java software.
  • 11. Data Types  The Java programming language is strongly-typed, which means that all variables must first be declared before they can be used. int gear = 1;  The eight primitive data types supported by the Java programming language are: – int, byte, short, long, float, double, boolean, char
  • 12. Naming Conventions  Java uses identifiers to name – variables – methods – classes – packages  Syntax rules – Must begin with a letter (upper- or lower-case) – May be followed by any number (including 0) of letters and digits – The characters $ and _ are considered letters – Java identifier names are case sensitive – May not duplicate a Java keyword (e.g. class or main)
  • 14. Control Structures  Loops: for, while, do while  If, if else, if else if, switch case
  • 15. Class and object  Class is a user defined data type.  Object is variable of a class – Data Members and Methods  Constructor  Method Overloading  Inheritance  Method Overriding