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

Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
yoavwix
 
Java compilation
Java compilationJava compilation
Java compilation
Mike Kucera
 
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
yohanbeschi
 

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 introduction to java

Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
kumar467
 

Similar to introduction to java (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

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

introduction to java

  • 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