SlideShare a Scribd company logo
1
JAVA PROGRAMMING
By
Dr.T.Abirami
Associate Professor
Department of IT
Kongu Engineering College Perundurai
2/3/2021
2
Introduction
2/3/2021
Author ,Year and Company
 Started in 1995 by SUN Microsystems
 James gosling, Arthur Van hoff, Andy
bechtolsheim
3
James Gosling
Oak is a symbol of strength
2/3/2021
Java Indroduction
 It is programming language
 It is class based and object oriented
programming language
 It is a platform independent language
 Java is both compiler and interpreter
language
 Java follows a bottom-up approach
4
2/3/2021
Real-World Java Applications
 Desktop GUI Applications
 Android Apps
 Web Applications
 Software Tools
 Trading Application
 J2ME Apps
 Embedded Space
 Big Data technologies
 Scientific Applications
5
2/3/2021
Example
 Banking: To deal with transaction management.
 Retail: Billing applications that you see in a
store/restaurant are completely written in Java.
 Information Technology: Java is designed to solve
implementation dependencies.
 Android: Applications are either written in Java or use Java
API.
 Financial services: It is used in server-side applications.
 Stock market: To write algorithms as to which company
they should invest in.
 Big Data: Hadoop MapReduce framework is written using
Java.
 Scientific and Research Community: To deal with huge
amount of data.
6
2/3/2021
Application
 Desktop Applications such as acrobat reader,
media player, antivirus, etc.
 Web Applications
 Enterprise Applications such as banking
applications.
 Mobile
 Embedded System
 Smart Card
 Robotics
 Games, etc.
7
2/3/2021
Where it is used?
 1. Google's (Gmail & Youtube) is built
on Java/some other lang.
2. Twitter (Netty) & Linkedin uses Java
& Scala.
3. Amazon, Ebay, Blogger uses almost
Java.
8
2/3/2021
Types of Java Applications
 1) Standalone Application
 2) Web Application
 3) Enterprise Application
 4) Mobile Application
9
2/3/2021
Java Editions
 1) Java SE (Java Standard Edition) - It is a
Java programming platform.
 2) Java EE (Java Enterprise Edition) - It is an
enterprise platform which is mainly used to develop web and
enterprise applications.
 3) Java ME (Java Micro Edition) - to develop
mobile applications.
 4) JavaFX-to develop rich internet applications.
10
2/3/2021
Popular companies
 Uber
 Airbnb
 Google
 Pinterest
 Netflix
 Spotify
 Amazon
 Slack
 Instagram, etc.
11
2/3/2021
Java Version History
 JDK Alpha and Beta (1995)
 JDK 1.0 (23rd Jan 1996)
 JDK 1.1 (19th Feb 1997)
 J2SE 1.2 (8th Dec 1998)
 J2SE 1.3 (8th May 2000)
 J2SE 1.4 (6th Feb 2002)
 J2SE 5.0 (30th Sep 2004)
 Java SE 6 (11th Dec 2006)
 Java SE 7 (28th July 2011)
 Java SE 8 (18th Mar 2014)
 Java SE 9 (21st Sep 2017)
 Java SE 10 (20th Mar 2018)
 Java SE 11 and 14 ,15
12
2/3/2021
A Step By Step Guide To How To
Setup Eclipse IDE On Windows?
 Install Java
 Setup Eclipse IDE on Windows
 Hello World Program
13
2/3/2021
How to Download and Install
Eclipse to Run Java
 Step 1: Go to the Java Downloads Page and click
on the option of Download.
https://www.oracle.com/in/java/technologies/jav
ase-downloads.html
 2. Setup path
14
2/3/2021
Set the path for Java(JDK)
 Step 2: Once the installation is over
follow the below instructions to set the
path of the file.
 Go to start and search for ‘System’. Then,
click on ‘System’ and go to Advanced
System Settings. Refer below.
15
2/3/2021
Now, click on ‘Environment Variables’
under ‘Advanced’ tab as shown below:
16
2/3/2021
Install Eclipse:
https://www.eclipse.org/downloads/packag
es/release/Neon/2
17
2/3/2021
JDK, JRE, and JVM
JVM
 JVM (Java Virtual Machine) is an abstract
machine.
 It is called a virtual machine because it doesn't
physically exist.
 It is a specification that provides a runtime
environment in which Java bytecode can be
executed.
 It can also run those programs which are written
in other languages and compiled to Java
bytecode.
18
2/3/2021
The JVM performs the following
main tasks:
 Loads code
 Verifies code
 Executes code
 Provides runtime environment
19
Execution Engine :It contains:
• A virtual processor
• Interpreter: Read bytecode stream then execute the instructions.
• Just-In-Time(JIT) compiler:
•It is used to improve the performance.
•JIT compiles parts of the byte code that have similar functionality at the same time,
and hence reduces the amount of time needed for compilation.
• Here, the term "compiler" refers to a translator from the instruction set of a Java
virtual machine (JVM) to the instruction set of a specific CPU.
2/3/2021
JRE
 JRE is an acronym for Java Runtime Environment.
 It is also written as Java RTE.
 It is a set of software tools which are used for
developing Java applications.
 It is used to provide the runtime environment.
 It is the implementation of JVM.
 It physically exists.
 It contains a set of libraries + other files that JVM
uses at runtime.
20
2/3/2021
JDK(Java Development Kit)
 It is a software development environment which is used to
develop Java applications and applets.
 It physically exists.
 It contains JRE + development tools.
 The JDK contains a private Java Virtual Machine (JVM) and a few
other resources such as an interpreter/loader (java), a compiler
(javac), an archiver (jar), a documentation generator (Javadoc),
etc. to complete the development of a Java Application.
21
2/3/2021
Learning Objectives
 To learn why Java is useful for the design of desktop , web and mobile
applications.
 To learn how to implement object-oriented designs with Java.
 To identify Java language components and how they work together in
applications.
 To design and program stand-alone Java applications.
 To learn how to design a graphical user interface (GUI) with Java AWT.
 To learn how to extend Java classes with inheritance and dynamic binding.
 To learn how to use exception handling in Java applications.
 To learn Java generics and how to use the Java Collections API.
 To understand how to design applications with threads in Java.
 To learn how to read and write files in Java.
22
2/3/2021
18ITO03 - JAVA
PROGRAMMING
23
2/3/2021
24
2/3/2021
LABORATORY
25
2/3/2021
26
First Program
public class HelloWorld {
public static void main(String args[])
{
System.out.println("Hello World");
}
}
2/3/2021
27
Compiling and Running
HelloWorld.java
javac HelloWorld.java
java HelloWorld HelloWorld.class
compile
run
bytecode
source code
2/3/2021
Why is JAVA a platform independent
language?
28
platform is the computer and the operating system running on it. The operating system can be
Windows, Mac, Linux, or any of many others It provides the environment to run the program
2/3/2021
Compiled Programs With Different
Operating Systems
Windows
compiler
Executable (Windows)
UNIX
compiler
Executable (UNIX)
Mac OS
compiler
Executable (Mac)
Computer
program
29
2/3/2021
A High Level View Of
Translating/Executing Java Programs
Java compiler
(javac)
Java program
Filename.java
Java
bytecode
(generic
binary)
Filename.class
Stage 1:
Compilation
30
2/3/2021
A High Level View Of
Translating/Executing Java Programs (2)
Java
interpreter
(java)
Java
bytecode
(generic
binary)
Filename.class
Machine language
instruction (UNIX)
Machine language
instruction
(Windows)
Machine language
instruction (Apple)
Stage 2: Interpreting and executing the
byte code
31
2/3/2021
Creating, Compiling And Running Java
Programs On The Computer Science
Network
javac
Java compiler
Java byte
code
filename.class
(UNIX file)
To compile the program
at the command line type
"javac filename.java"
To run the interpreter,
at the command line
type "java filename"
java
Java
Interpreter
Type it in with the text editor of
your choice
filename.java
(Unix file)
Java
program
32
2/3/2021
Compiling The Smallest Java Program
public class Smallest
{
public static void main (String[] args)
{
}
}
Smallest.java
javac
(Java byte code)
10000100000001000
00100100000001001
: :
Smallest.class
Type “javac
Smallest.java”
33
2/3/2021
Running The Smallest Java Program
(Java byte code)
10000100000001000
00100100000001001
: :
Smallest.class
java
Type “java
Smallest”
(Platform/Operating specific binary
10100111000001000
00100111001111001
: :
34
2/3/2021
35
Notice:
 Java is CASE SENSITIVE!!
 File name has to be the same as class
name in file.
 Need to import necessary class definitions
2/3/2021

More Related Content

What's hot (17)

PPTX
Android summer training report
Shashendra Singh
 
PPTX
Java Programming (M&M)
mafffffe19
 
PPTX
Features of java unit 1
RubaNagarajan
 
PDF
Summer training report on java se6 technology
Shamsher Ahmed
 
PDF
Core java kvr - satya
Satya Johnny
 
PDF
Java application-development
Deepika Chaudhary
 
DOCX
Core Java Training report
Sumit Kumar Sharma
 
DOCX
Advance java summer training report
Nitesh Saini
 
PPT
Professional-core-java-training
Vibrant Technologies & Computers
 
DOCX
Industrial Training report on java
Softvision Info Solutions Private Limited
 
PDF
130700548484460000
Tanzeel Ahmad
 
DOCX
Core java report
Sumit Jain
 
PDF
Report summer training core java
SudhanshuVijay3
 
PDF
Introduction to java
shwanjava
 
PDF
J introtojava1-pdf
Emmanuel Alimpolos
 
PDF
Ijetcas14 385
Iasir Journals
 
PPTX
Object oriented programming-with_java
Hoang Nguyen
 
Android summer training report
Shashendra Singh
 
Java Programming (M&M)
mafffffe19
 
Features of java unit 1
RubaNagarajan
 
Summer training report on java se6 technology
Shamsher Ahmed
 
Core java kvr - satya
Satya Johnny
 
Java application-development
Deepika Chaudhary
 
Core Java Training report
Sumit Kumar Sharma
 
Advance java summer training report
Nitesh Saini
 
Professional-core-java-training
Vibrant Technologies & Computers
 
Industrial Training report on java
Softvision Info Solutions Private Limited
 
130700548484460000
Tanzeel Ahmad
 
Core java report
Sumit Jain
 
Report summer training core java
SudhanshuVijay3
 
Introduction to java
shwanjava
 
J introtojava1-pdf
Emmanuel Alimpolos
 
Ijetcas14 385
Iasir Journals
 
Object oriented programming-with_java
Hoang Nguyen
 

Similar to Java Programming : introduction (20)

PPSX
Java Semimar Slide (Cetpa)
Pratima Parida
 
DOCX
Project report for final year project
suneel singh
 
PPT
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
PPT
Java2020 programming basics and fundamentals
swecsaleem
 
PPT
Java & J2EE Struts with Hibernate Framework
Mohit Belwal
 
PPTX
C,c++,java,php,.net training institute in delhi, best training institute for ...
MCM COmpetitive Classes
 
PDF
Ah java-ppt1
Haja Abdul Khader A
 
PPT
Core Java Slides
Vinit Vyas
 
PPTX
1_Introduction to Java.pptx java programming
amitraj53904
 
PPTX
JAVA PROGRAMMING-Unit I - Final PPT.pptx
SuganthiDPSGRKCW
 
PDF
Java Is A Programming Dialect And Registering Stage Essay
Liz Sims
 
PPTX
best java training institute in Chandigarh ppt
vanshikashr2324
 
PPTX
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
anshkhurana01
 
PPTX
Introduction to java
Kalai Selvi
 
PPT
Java presentation
Karan Sareen
 
PDF
Java Notes.pdfTells computer what to do. • These instructions are called code. •
ashutoshkumar12345ku
 
PDF
Java course in Chandigarh.pdf
ExcellenceTechnology9
 
DOCX
FRAUD DETECTION IN ONLINE AUCTIONING
Satish Chandra
 
PPTX
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
kafuurismail
 
PPT
Chapter 1 introduction to java technology
sshhzap
 
Java Semimar Slide (Cetpa)
Pratima Parida
 
Project report for final year project
suneel singh
 
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
Java2020 programming basics and fundamentals
swecsaleem
 
Java & J2EE Struts with Hibernate Framework
Mohit Belwal
 
C,c++,java,php,.net training institute in delhi, best training institute for ...
MCM COmpetitive Classes
 
Ah java-ppt1
Haja Abdul Khader A
 
Core Java Slides
Vinit Vyas
 
1_Introduction to Java.pptx java programming
amitraj53904
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
SuganthiDPSGRKCW
 
Java Is A Programming Dialect And Registering Stage Essay
Liz Sims
 
best java training institute in Chandigarh ppt
vanshikashr2324
 
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
anshkhurana01
 
Introduction to java
Kalai Selvi
 
Java presentation
Karan Sareen
 
Java Notes.pdfTells computer what to do. • These instructions are called code. •
ashutoshkumar12345ku
 
Java course in Chandigarh.pdf
ExcellenceTechnology9
 
FRAUD DETECTION IN ONLINE AUCTIONING
Satish Chandra
 
DIT 206 LECTURE 2 - Features of the Java Programming Language copy.pptx
kafuurismail
 
Chapter 1 introduction to java technology
sshhzap
 
Ad

More from Kongu Engineering College, Perundurai, Erode (20)

PPTX
Introduction to Generative AI refers to a subset of artificial intelligence
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
 
PPTX
Connect to NoSQL Database (MongoDB) using Node JS & Connect Node.js with NoSQ...
Kongu Engineering College, Perundurai, Erode
 
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
PPTX
Node.js web-based Example :Run a local server in order to start using node.js...
Kongu Engineering College, Perundurai, Erode
 
PPT
Concepts of Satellite Communication and types and its applications
Kongu Engineering College, Perundurai, Erode
 
PPT
Concepts of Mobile Communication Wireless LANs, Bluetooth , HiperLAN
Kongu Engineering College, Perundurai, Erode
 
PPTX
Web Technology Introduction framework.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Computer Network - Unicast Routing Distance vector Link state vector
Kongu Engineering College, Perundurai, Erode
 
PPT
Android SQLite database oriented application development
Kongu Engineering College, Perundurai, Erode
 
PPT
Android Application Development Programming
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Spring & Spring BootFramework
Kongu Engineering College, Perundurai, Erode
 
PPTX
A REST API (also called a RESTful API or RESTful web API) is an application p...
Kongu Engineering College, Perundurai, Erode
 
PPTX
SOA and Monolith Architecture - Micro Services.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Connect to NoSQL Database using Node JS.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Bootstarp installation.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
nested_Object as Parameter & Recursion_Later_commamd.pptx
Kongu Engineering College, Perundurai, Erode
 
Introduction to Generative AI refers to a subset of artificial intelligence
Kongu Engineering College, Perundurai, Erode
 
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
 
Connect to NoSQL Database (MongoDB) using Node JS & Connect Node.js with NoSQ...
Kongu Engineering College, Perundurai, Erode
 
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
Node.js web-based Example :Run a local server in order to start using node.js...
Kongu Engineering College, Perundurai, Erode
 
Concepts of Satellite Communication and types and its applications
Kongu Engineering College, Perundurai, Erode
 
Concepts of Mobile Communication Wireless LANs, Bluetooth , HiperLAN
Kongu Engineering College, Perundurai, Erode
 
Web Technology Introduction framework.pptx
Kongu Engineering College, Perundurai, Erode
 
Computer Network - Unicast Routing Distance vector Link state vector
Kongu Engineering College, Perundurai, Erode
 
Android SQLite database oriented application development
Kongu Engineering College, Perundurai, Erode
 
Android Application Development Programming
Kongu Engineering College, Perundurai, Erode
 
Introduction to Spring & Spring BootFramework
Kongu Engineering College, Perundurai, Erode
 
A REST API (also called a RESTful API or RESTful web API) is an application p...
Kongu Engineering College, Perundurai, Erode
 
SOA and Monolith Architecture - Micro Services.pptx
Kongu Engineering College, Perundurai, Erode
 
Connect to NoSQL Database using Node JS.pptx
Kongu Engineering College, Perundurai, Erode
 
nested_Object as Parameter & Recursion_Later_commamd.pptx
Kongu Engineering College, Perundurai, Erode
 
Ad

Recently uploaded (20)

PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PDF
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
PPTX
Innowell Capability B0425 - Commercial Buildings.pptx
regobertroza
 
PDF
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Day2 B2 Best.pptx
helenjenefa1
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
Innowell Capability B0425 - Commercial Buildings.pptx
regobertroza
 
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Design Thinking basics for Engineers.pdf
CMR University
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 

Java Programming : introduction

  • 1. 1 JAVA PROGRAMMING By Dr.T.Abirami Associate Professor Department of IT Kongu Engineering College Perundurai 2/3/2021
  • 3. Author ,Year and Company  Started in 1995 by SUN Microsystems  James gosling, Arthur Van hoff, Andy bechtolsheim 3 James Gosling Oak is a symbol of strength 2/3/2021
  • 4. Java Indroduction  It is programming language  It is class based and object oriented programming language  It is a platform independent language  Java is both compiler and interpreter language  Java follows a bottom-up approach 4 2/3/2021
  • 5. Real-World Java Applications  Desktop GUI Applications  Android Apps  Web Applications  Software Tools  Trading Application  J2ME Apps  Embedded Space  Big Data technologies  Scientific Applications 5 2/3/2021
  • 6. Example  Banking: To deal with transaction management.  Retail: Billing applications that you see in a store/restaurant are completely written in Java.  Information Technology: Java is designed to solve implementation dependencies.  Android: Applications are either written in Java or use Java API.  Financial services: It is used in server-side applications.  Stock market: To write algorithms as to which company they should invest in.  Big Data: Hadoop MapReduce framework is written using Java.  Scientific and Research Community: To deal with huge amount of data. 6 2/3/2021
  • 7. Application  Desktop Applications such as acrobat reader, media player, antivirus, etc.  Web Applications  Enterprise Applications such as banking applications.  Mobile  Embedded System  Smart Card  Robotics  Games, etc. 7 2/3/2021
  • 8. Where it is used?  1. Google's (Gmail & Youtube) is built on Java/some other lang. 2. Twitter (Netty) & Linkedin uses Java & Scala. 3. Amazon, Ebay, Blogger uses almost Java. 8 2/3/2021
  • 9. Types of Java Applications  1) Standalone Application  2) Web Application  3) Enterprise Application  4) Mobile Application 9 2/3/2021
  • 10. Java Editions  1) Java SE (Java Standard Edition) - It is a Java programming platform.  2) Java EE (Java Enterprise Edition) - It is an enterprise platform which is mainly used to develop web and enterprise applications.  3) Java ME (Java Micro Edition) - to develop mobile applications.  4) JavaFX-to develop rich internet applications. 10 2/3/2021
  • 11. Popular companies  Uber  Airbnb  Google  Pinterest  Netflix  Spotify  Amazon  Slack  Instagram, etc. 11 2/3/2021
  • 12. Java Version History  JDK Alpha and Beta (1995)  JDK 1.0 (23rd Jan 1996)  JDK 1.1 (19th Feb 1997)  J2SE 1.2 (8th Dec 1998)  J2SE 1.3 (8th May 2000)  J2SE 1.4 (6th Feb 2002)  J2SE 5.0 (30th Sep 2004)  Java SE 6 (11th Dec 2006)  Java SE 7 (28th July 2011)  Java SE 8 (18th Mar 2014)  Java SE 9 (21st Sep 2017)  Java SE 10 (20th Mar 2018)  Java SE 11 and 14 ,15 12 2/3/2021
  • 13. A Step By Step Guide To How To Setup Eclipse IDE On Windows?  Install Java  Setup Eclipse IDE on Windows  Hello World Program 13 2/3/2021
  • 14. How to Download and Install Eclipse to Run Java  Step 1: Go to the Java Downloads Page and click on the option of Download. https://www.oracle.com/in/java/technologies/jav ase-downloads.html  2. Setup path 14 2/3/2021
  • 15. Set the path for Java(JDK)  Step 2: Once the installation is over follow the below instructions to set the path of the file.  Go to start and search for ‘System’. Then, click on ‘System’ and go to Advanced System Settings. Refer below. 15 2/3/2021
  • 16. Now, click on ‘Environment Variables’ under ‘Advanced’ tab as shown below: 16 2/3/2021
  • 18. JDK, JRE, and JVM JVM  JVM (Java Virtual Machine) is an abstract machine.  It is called a virtual machine because it doesn't physically exist.  It is a specification that provides a runtime environment in which Java bytecode can be executed.  It can also run those programs which are written in other languages and compiled to Java bytecode. 18 2/3/2021
  • 19. The JVM performs the following main tasks:  Loads code  Verifies code  Executes code  Provides runtime environment 19 Execution Engine :It contains: • A virtual processor • Interpreter: Read bytecode stream then execute the instructions. • Just-In-Time(JIT) compiler: •It is used to improve the performance. •JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. • Here, the term "compiler" refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU. 2/3/2021
  • 20. JRE  JRE is an acronym for Java Runtime Environment.  It is also written as Java RTE.  It is a set of software tools which are used for developing Java applications.  It is used to provide the runtime environment.  It is the implementation of JVM.  It physically exists.  It contains a set of libraries + other files that JVM uses at runtime. 20 2/3/2021
  • 21. JDK(Java Development Kit)  It is a software development environment which is used to develop Java applications and applets.  It physically exists.  It contains JRE + development tools.  The JDK contains a private Java Virtual Machine (JVM) and a few other resources such as an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), etc. to complete the development of a Java Application. 21 2/3/2021
  • 22. Learning Objectives  To learn why Java is useful for the design of desktop , web and mobile applications.  To learn how to implement object-oriented designs with Java.  To identify Java language components and how they work together in applications.  To design and program stand-alone Java applications.  To learn how to design a graphical user interface (GUI) with Java AWT.  To learn how to extend Java classes with inheritance and dynamic binding.  To learn how to use exception handling in Java applications.  To learn Java generics and how to use the Java Collections API.  To understand how to design applications with threads in Java.  To learn how to read and write files in Java. 22 2/3/2021
  • 26. 26 First Program public class HelloWorld { public static void main(String args[]) { System.out.println("Hello World"); } } 2/3/2021
  • 27. 27 Compiling and Running HelloWorld.java javac HelloWorld.java java HelloWorld HelloWorld.class compile run bytecode source code 2/3/2021
  • 28. Why is JAVA a platform independent language? 28 platform is the computer and the operating system running on it. The operating system can be Windows, Mac, Linux, or any of many others It provides the environment to run the program 2/3/2021
  • 29. Compiled Programs With Different Operating Systems Windows compiler Executable (Windows) UNIX compiler Executable (UNIX) Mac OS compiler Executable (Mac) Computer program 29 2/3/2021
  • 30. A High Level View Of Translating/Executing Java Programs Java compiler (javac) Java program Filename.java Java bytecode (generic binary) Filename.class Stage 1: Compilation 30 2/3/2021
  • 31. A High Level View Of Translating/Executing Java Programs (2) Java interpreter (java) Java bytecode (generic binary) Filename.class Machine language instruction (UNIX) Machine language instruction (Windows) Machine language instruction (Apple) Stage 2: Interpreting and executing the byte code 31 2/3/2021
  • 32. Creating, Compiling And Running Java Programs On The Computer Science Network javac Java compiler Java byte code filename.class (UNIX file) To compile the program at the command line type "javac filename.java" To run the interpreter, at the command line type "java filename" java Java Interpreter Type it in with the text editor of your choice filename.java (Unix file) Java program 32 2/3/2021
  • 33. Compiling The Smallest Java Program public class Smallest { public static void main (String[] args) { } } Smallest.java javac (Java byte code) 10000100000001000 00100100000001001 : : Smallest.class Type “javac Smallest.java” 33 2/3/2021
  • 34. Running The Smallest Java Program (Java byte code) 10000100000001000 00100100000001001 : : Smallest.class java Type “java Smallest” (Platform/Operating specific binary 10100111000001000 00100111001111001 : : 34 2/3/2021
  • 35. 35 Notice:  Java is CASE SENSITIVE!!  File name has to be the same as class name in file.  Need to import necessary class definitions 2/3/2021