SlideShare a Scribd company logo
1 of 8
EXPLAINING THE JAVA COMPILER
& INTERPRETER
Chapter 2.3:
Java
 There are hundreds of high level computer
languages. Java, C++, C, Basic, Fortran,
Cobol, Lisp, Perl, Prolog, Eiffel, Python
 The capabilities of the languages vary
widely, but they all need a way to do
 declarative statements
 conditional statements
 iterative or repetitive statements
 A compiler is a program that converts
commands in high level languages to
machine language instructions
A Picture is Worth…
The Interpreter's are sometimes referred to as the
Java Virtual Machines
The output of the
compiler is .class
file
A Simple Java Program
public class Hello
{ public static void main(String[] args)
{ System.out.println("Hello World!");
}
}
This would be in a text file named Hello.java
DEMO of writing and running a program via notepad
and the command line
More Definitions
 code or source code: The sequence of
instructions in a particular program.
 The code in this program instructs the computer
to print a message of Hello, world! on the
screen.
 output: The messages printed to the
computer user by a program.
 console: The text box or window onto
which output is printed.
Compiling and Running
 Compiler: a program that converts a program
in one language to another language
 compile from C++ to machine code
 compile Java to bytecode
 Bytecode: a language for an imaginary cpu
 Interpreter: A converts one instruction or line
of code from one language to another and
then executes that instruction
 When java programs are run the bytecode produced
by the compiler is fed to an interpreter that converts
it to machine code for a particular CPU
 on my machine it converts it to instructions for a
Pentium cpu
The command line
To run a Java program using
your Command Prompt:
 change to the directory
of your program
cd
 compile the program
javac Hello.java
 execute the program
java Hello
source code
(Hello.java)
compile
byte code
(Hello.class)
execute
output
Another Java program
public class Hello2 {
public static void main(String[] args) {
System.out.println("Hello, world!");
System.out.println();
System.out.println("This program
produces");
System.out.println("four lines of
output");
}
}
 The code in this program instructs the computer to print
four messages on the screen.

More Related Content

What's hot

Chapter 1.3
Chapter 1.3Chapter 1.3
Chapter 1.3
sotlsoc
 
QBASIC
QBASICQBASIC
QBASIC
nivi88
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
Tech
 
Introducing c# (hemant)
Introducing c# (hemant)Introducing c# (hemant)
Introducing c# (hemant)
hrajak5
 

What's hot (20)

Chapter 1.3
Chapter 1.3Chapter 1.3
Chapter 1.3
 
QBASIC
QBASICQBASIC
QBASIC
 
single pass compiler and its architecture
single pass compiler and its architecturesingle pass compiler and its architecture
single pass compiler and its architecture
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Interpreted and compiled language
Interpreted and compiled languageInterpreted and compiled language
Interpreted and compiled language
 
Language translator
Language translatorLanguage translator
Language translator
 
Compilers
CompilersCompilers
Compilers
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
 
Compiler interpreter and_bootstrapping
Compiler interpreter and_bootstrappingCompiler interpreter and_bootstrapping
Compiler interpreter and_bootstrapping
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)
 
Compilation of c
Compilation of cCompilation of c
Compilation of c
 
Adding commands
Adding commandsAdding commands
Adding commands
 
Programming
ProgrammingProgramming
Programming
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
Compilers Computer Program | Computer Science
Compilers Computer Program | Computer ScienceCompilers Computer Program | Computer Science
Compilers Computer Program | Computer Science
 
Introducing c# (hemant)
Introducing c# (hemant)Introducing c# (hemant)
Introducing c# (hemant)
 
C lecture notes new
C lecture notes newC lecture notes new
C lecture notes new
 
Computer programming
Computer programmingComputer programming
Computer programming
 
Unit 1 of java part 1 basic introduction akr
Unit 1 of java part 1 basic introduction akrUnit 1 of java part 1 basic introduction akr
Unit 1 of java part 1 basic introduction akr
 

Viewers also liked

5. spooling and buffering
5. spooling and buffering 5. spooling and buffering
5. spooling and buffering
myrajendra
 

Viewers also liked (11)

4 various operating systems
4 various operating systems4 various operating systems
4 various operating systems
 
Input and output devices
Input and output devicesInput and output devices
Input and output devices
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Ch3: Operating System Structure
Ch3: Operating System StructureCh3: Operating System Structure
Ch3: Operating System Structure
 
Interpreter
InterpreterInterpreter
Interpreter
 
compiler vs interpreter
compiler vs interpretercompiler vs interpreter
compiler vs interpreter
 
5. spooling and buffering
5. spooling and buffering 5. spooling and buffering
5. spooling and buffering
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Kernel (OS)
Kernel (OS)Kernel (OS)
Kernel (OS)
 

Similar to Chapter 2.3

La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
Cma Mohd
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
manishamorya
 

Similar to Chapter 2.3 (20)

Programming Fundamentals and Programming Languages Concepts Translators
Programming Fundamentals and Programming Languages Concepts TranslatorsProgramming Fundamentals and Programming Languages Concepts Translators
Programming Fundamentals and Programming Languages Concepts Translators
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
First session quiz
First session quizFirst session quiz
First session quiz
 
First session quiz
First session quizFirst session quiz
First session quiz
 
java 1 new.pdf
java 1 new.pdfjava 1 new.pdf
java 1 new.pdf
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Programming 1: Compilers, Interpreters & Bytecode
Programming 1: Compilers, Interpreters & BytecodeProgramming 1: Compilers, Interpreters & Bytecode
Programming 1: Compilers, Interpreters & Bytecode
 
Source vs object code
Source vs object codeSource vs object code
Source vs object code
 
Ppt chapter02
Ppt chapter02Ppt chapter02
Ppt chapter02
 
C intro
C introC intro
C intro
 
C PROGRAMMING
C PROGRAMMINGC PROGRAMMING
C PROGRAMMING
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
Topic2IntroductionToJavaProgramming.ppt
Topic2IntroductionToJavaProgramming.pptTopic2IntroductionToJavaProgramming.ppt
Topic2IntroductionToJavaProgramming.ppt
 
01review
01review01review
01review
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
 
Lesson 1 - Introduction to Computer Programming.pptx
Lesson 1 - Introduction to Computer Programming.pptxLesson 1 - Introduction to Computer Programming.pptx
Lesson 1 - Introduction to Computer Programming.pptx
 
About java
About javaAbout java
About java
 
Java lab zero lecture
Java  lab  zero lectureJava  lab  zero lecture
Java lab zero lecture
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
 

More from sotlsoc

Chapter 2.0 new
Chapter 2.0 newChapter 2.0 new
Chapter 2.0 new
sotlsoc
 
Chapter 1.0 new
Chapter 1.0 newChapter 1.0 new
Chapter 1.0 new
sotlsoc
 
Chapter 3.0 new
Chapter 3.0 newChapter 3.0 new
Chapter 3.0 new
sotlsoc
 
Chapter 6.5 new
Chapter 6.5 newChapter 6.5 new
Chapter 6.5 new
sotlsoc
 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
sotlsoc
 
Chapter 10.3
Chapter 10.3Chapter 10.3
Chapter 10.3
sotlsoc
 
Chapter 11.4
Chapter 11.4Chapter 11.4
Chapter 11.4
sotlsoc
 
Chapter 11.3
Chapter 11.3Chapter 11.3
Chapter 11.3
sotlsoc
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
sotlsoc
 
Chapter 11.2
Chapter 11.2Chapter 11.2
Chapter 11.2
sotlsoc
 
Chapter 11.0
Chapter 11.0Chapter 11.0
Chapter 11.0
sotlsoc
 
Chapter 10.2
Chapter 10.2Chapter 10.2
Chapter 10.2
sotlsoc
 
Chapter 10.1
Chapter 10.1Chapter 10.1
Chapter 10.1
sotlsoc
 
Chapter 8.0
Chapter 8.0Chapter 8.0
Chapter 8.0
sotlsoc
 
Chapter 10.0
Chapter 10.0Chapter 10.0
Chapter 10.0
sotlsoc
 
Chapter 9.3
Chapter 9.3Chapter 9.3
Chapter 9.3
sotlsoc
 
Chapter 9.4
Chapter 9.4Chapter 9.4
Chapter 9.4
sotlsoc
 
Chapter 9.1
Chapter 9.1Chapter 9.1
Chapter 9.1
sotlsoc
 
Chapter 8.1
Chapter 8.1Chapter 8.1
Chapter 8.1
sotlsoc
 
Chapter 9.0
Chapter 9.0Chapter 9.0
Chapter 9.0
sotlsoc
 

More from sotlsoc (20)

Chapter 2.0 new
Chapter 2.0 newChapter 2.0 new
Chapter 2.0 new
 
Chapter 1.0 new
Chapter 1.0 newChapter 1.0 new
Chapter 1.0 new
 
Chapter 3.0 new
Chapter 3.0 newChapter 3.0 new
Chapter 3.0 new
 
Chapter 6.5 new
Chapter 6.5 newChapter 6.5 new
Chapter 6.5 new
 
Chapter 11.1
Chapter 11.1Chapter 11.1
Chapter 11.1
 
Chapter 10.3
Chapter 10.3Chapter 10.3
Chapter 10.3
 
Chapter 11.4
Chapter 11.4Chapter 11.4
Chapter 11.4
 
Chapter 11.3
Chapter 11.3Chapter 11.3
Chapter 11.3
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
 
Chapter 11.2
Chapter 11.2Chapter 11.2
Chapter 11.2
 
Chapter 11.0
Chapter 11.0Chapter 11.0
Chapter 11.0
 
Chapter 10.2
Chapter 10.2Chapter 10.2
Chapter 10.2
 
Chapter 10.1
Chapter 10.1Chapter 10.1
Chapter 10.1
 
Chapter 8.0
Chapter 8.0Chapter 8.0
Chapter 8.0
 
Chapter 10.0
Chapter 10.0Chapter 10.0
Chapter 10.0
 
Chapter 9.3
Chapter 9.3Chapter 9.3
Chapter 9.3
 
Chapter 9.4
Chapter 9.4Chapter 9.4
Chapter 9.4
 
Chapter 9.1
Chapter 9.1Chapter 9.1
Chapter 9.1
 
Chapter 8.1
Chapter 8.1Chapter 8.1
Chapter 8.1
 
Chapter 9.0
Chapter 9.0Chapter 9.0
Chapter 9.0
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
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
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.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.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

Chapter 2.3

  • 1. EXPLAINING THE JAVA COMPILER & INTERPRETER Chapter 2.3:
  • 2. Java  There are hundreds of high level computer languages. Java, C++, C, Basic, Fortran, Cobol, Lisp, Perl, Prolog, Eiffel, Python  The capabilities of the languages vary widely, but they all need a way to do  declarative statements  conditional statements  iterative or repetitive statements  A compiler is a program that converts commands in high level languages to machine language instructions
  • 3. A Picture is Worth… The Interpreter's are sometimes referred to as the Java Virtual Machines The output of the compiler is .class file
  • 4. A Simple Java Program public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); } } This would be in a text file named Hello.java DEMO of writing and running a program via notepad and the command line
  • 5. More Definitions  code or source code: The sequence of instructions in a particular program.  The code in this program instructs the computer to print a message of Hello, world! on the screen.  output: The messages printed to the computer user by a program.  console: The text box or window onto which output is printed.
  • 6. Compiling and Running  Compiler: a program that converts a program in one language to another language  compile from C++ to machine code  compile Java to bytecode  Bytecode: a language for an imaginary cpu  Interpreter: A converts one instruction or line of code from one language to another and then executes that instruction  When java programs are run the bytecode produced by the compiler is fed to an interpreter that converts it to machine code for a particular CPU  on my machine it converts it to instructions for a Pentium cpu
  • 7. The command line To run a Java program using your Command Prompt:  change to the directory of your program cd  compile the program javac Hello.java  execute the program java Hello source code (Hello.java) compile byte code (Hello.class) execute output
  • 8. Another Java program public class Hello2 { public static void main(String[] args) { System.out.println("Hello, world!"); System.out.println(); System.out.println("This program produces"); System.out.println("four lines of output"); } }  The code in this program instructs the computer to print four messages on the screen.