EXPLAINING THE PROGRAMMING
PROCESS & TYPES OF ERRORS
Chapter 1.3:
The Java Programming Language
 Created by Sun Microsystems, Inc.
 introduced in 1995 and it's popularity has grown
quickly since
 Rich library
 Platform-independent ("write once, run anywhere")
or architecture-neutral
Java Translation
 The Java compiler translates Java source code
into a special representation called bytecode
 Java bytecode is not the machine language for
any traditional CPU
 Another Java software tool, called an interpreter
(or Java Virtual Machine (JVM)) , translates
bytecode into machine language and executes it
Java Translation
Java source
code (program)
Machine
code
Java
bytecode
Bytecode
interpreter
Java
compiler
Portability
 After compiling a Java program into byte-code,
that byte-code can be used on any computer with
a byte-code interpreter and without a need to
recompile.
 Byte-code can be sent over the Internet and used
anywhere in the world.
 This makes Java suitable for Internet applications.
Becoming Familiar with your
Computer to use Java
 Understand files and folders/directories
 Locate the Java compiler/ Install J2SE
 Set path & Java class path
 Write a simple program (later)
 Save your work
 Compile & run
 Use Dos Command Prompt or IDE
A DOS Command Window
An Integrated Development
Environment
File Hello.java
1 public class Hello
2 {
3 public static void main(String[] args)
4 {
5 // display a greeting in the console window
6 System.out.println("Hello, World!");
7 }
8 }
Java Program Elements
 A Java program is made up of class definitions.
 A class definition must contains a header and a
body.
 A class contains zero or more methods
 A method is a named section of code that also has
a header & body
 A method contains program statements
 Single-line (starts with //) and multi-line (enclosed
by /* and */) comments are used to document the
code
Java Program Structure
public class Hello
{
}
// comments about the class
class header
class body
//Comments can be placed almost anywhere
Java Program Structure
public class MyProgram
{
}
// comments about the class
public static void main (String[] args)
{
}
// comments about the method
method header
method body
Compiling and Running
 Type program into text editor
 Save (file name must be similar to class name)
 Open Dos Window
 Change directory to saved file directory
 Compile into byte codes
javac Hello.java
 Execute byte codes
java Hello
Processing a Java Program
Class Loader
 A Java program typically consists of several
pieces called classes.
 Each class may have a separate author and each
is compiled (translated into byte-code) separately.
 A class loader (called a linker in other
programming languages) automatically connects
the classes together and loads the compiled code
(bytecode) into main memory.
Creating a Java Program…
JVM
Create/modify source code
Source code
Compile source code
Byte code
Run byte code
Output
Syntax errors
Runtime errors or
incorrect results
Errors
 It is common for programmer to make mistake in a
program.
 Three kinds of errors
 Syntax errors
 Runtime errors
 Logic errors
Syntax Errors
 Grammatical mistakes in a program
 The grammatical rules for writing a program are very strict
 The compiler catches syntax errors and prints an
error message.
 Example: using a period where a program expects
a semicolon
 System.out.print("..."),
 System.out.print("Hello);
Runtime Errors
 Errors that are detected when your program is
running, but not during compilation
 When the computer detects an error, it terminates
the program and prints an error message.
 Example: attempting to divide by 0
Logic Errors
 Errors that are not detected during compilation or
while running, but which cause the program to
produce incorrect results
 Example: an attempt to calculate a Fahrenheit
temperature from a Celsius temperature by
multiplying by 9/5 and adding 23 instead of 32
 E.g
 System.out.print("Hell");

More Related Content

PPTX
Java architecture
PPTX
Java byte code presentation
PPTX
History of java'
DOCX
JDK,JRE,JVM
PPTX
Java virtual machine
PPTX
Presentación rs232 java
PPTX
Architecture diagram of jvm
Java architecture
Java byte code presentation
History of java'
JDK,JRE,JVM
Java virtual machine
Presentación rs232 java
Architecture diagram of jvm

What's hot (20)

PPTX
The Java Story
PDF
Java introduction with JVM architecture
PPT
Java-java virtual machine
PPTX
Java introduction
PPT
Byte code jvm
PDF
Java Virtual Machine - Internal Architecture
PPTX
Features of JAVA Programming Language.
DOCX
Java and its features
PPTX
QSpiders - Jdk Jvm Jre and Jit
PPTX
Java Virtual Machine
PPTX
Important features of java
PPTX
QSpiders - Memory (JVM architecture)
PPTX
Jdk,jre,jvm
PPTX
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
PPTX
Features of java
PPTX
Jvm Architecture
PDF
JAVA Program Examples
The Java Story
Java introduction with JVM architecture
Java-java virtual machine
Java introduction
Byte code jvm
Java Virtual Machine - Internal Architecture
Features of JAVA Programming Language.
Java and its features
QSpiders - Jdk Jvm Jre and Jit
Java Virtual Machine
Important features of java
QSpiders - Memory (JVM architecture)
Jdk,jre,jvm
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Features of java
Jvm Architecture
JAVA Program Examples
Ad

Similar to Chapter 1.3 (20)

PPTX
Java Programming Fundamentals
PDF
java 1 new.pdf
PPTX
01_Java_Programming_Lecture-01_FCIT.pptx
PDF
201707 CSE110 Lecture 02
PPT
java tutorial for beginners learning.ppt
PPT
Chapter 1 java
PPTX
flowchart demasdasddasdsadsadsadasoasd.pptx
PPT
Lecture_1_Java_Programming_2023tttttttttt.ppt
PPTX
java intro.pptx
PPTX
JAVA PROGRAMMING BCA SECOND SEMESTER....
PPTX
Lesson1 intro
PPTX
Lesson1 intro
PPTX
Introduction to java
PDF
Core Java Tutorial
PDF
Java lab1 manual
PPTX
1 introduction
PPTX
Intro to programing with java-lecture 1
PPT
Java Course — Mastering the Fundamentals
PDF
Hello World Program in Java .pdf
PDF
Java Programming
Java Programming Fundamentals
java 1 new.pdf
01_Java_Programming_Lecture-01_FCIT.pptx
201707 CSE110 Lecture 02
java tutorial for beginners learning.ppt
Chapter 1 java
flowchart demasdasddasdsadsadsadasoasd.pptx
Lecture_1_Java_Programming_2023tttttttttt.ppt
java intro.pptx
JAVA PROGRAMMING BCA SECOND SEMESTER....
Lesson1 intro
Lesson1 intro
Introduction to java
Core Java Tutorial
Java lab1 manual
1 introduction
Intro to programing with java-lecture 1
Java Course — Mastering the Fundamentals
Hello World Program in Java .pdf
Java Programming
Ad

More from sotlsoc (20)

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

Recently uploaded (20)

PPT
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
PPTX
Thinking Routines and Learning Engagements.pptx
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
1.Salivary gland disease.pdf 3.Bleeding and Clotting Disorders.pdf important
PPTX
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
PDF
Health aspects of bilberry: A review on its general benefits
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PPTX
2025 High Blood Pressure Guideline Slide Set.pptx
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PDF
Chevening Scholarship Application and Interview Preparation Guide
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
PDF
Journal of Dental Science - UDMY (2020).pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
Solved Past paper of Pediatric Health Nursing PHN BS Nursing 5th Semester
PDF
0520_Scheme_of_Work_(for_examination_from_2021).pdf
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
PDF
Civil Department's presentation Your score increases as you pick a category
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
Thinking Routines and Learning Engagements.pptx
Nurlina - Urban Planner Portfolio (english ver)
1.Salivary gland disease.pdf 3.Bleeding and Clotting Disorders.pdf important
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
Health aspects of bilberry: A review on its general benefits
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
2025 High Blood Pressure Guideline Slide Set.pptx
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
Chevening Scholarship Application and Interview Preparation Guide
faiz-khans about Radiotherapy Physics-02.pdf
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
Journal of Dental Science - UDMY (2020).pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
Solved Past paper of Pediatric Health Nursing PHN BS Nursing 5th Semester
0520_Scheme_of_Work_(for_examination_from_2021).pdf
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
Civil Department's presentation Your score increases as you pick a category

Chapter 1.3

  • 1. EXPLAINING THE PROGRAMMING PROCESS & TYPES OF ERRORS Chapter 1.3:
  • 2. The Java Programming Language  Created by Sun Microsystems, Inc.  introduced in 1995 and it's popularity has grown quickly since  Rich library  Platform-independent ("write once, run anywhere") or architecture-neutral
  • 3. Java Translation  The Java compiler translates Java source code into a special representation called bytecode  Java bytecode is not the machine language for any traditional CPU  Another Java software tool, called an interpreter (or Java Virtual Machine (JVM)) , translates bytecode into machine language and executes it
  • 4. Java Translation Java source code (program) Machine code Java bytecode Bytecode interpreter Java compiler
  • 5. Portability  After compiling a Java program into byte-code, that byte-code can be used on any computer with a byte-code interpreter and without a need to recompile.  Byte-code can be sent over the Internet and used anywhere in the world.  This makes Java suitable for Internet applications.
  • 6. Becoming Familiar with your Computer to use Java  Understand files and folders/directories  Locate the Java compiler/ Install J2SE  Set path & Java class path  Write a simple program (later)  Save your work  Compile & run  Use Dos Command Prompt or IDE
  • 7. A DOS Command Window
  • 9. File Hello.java 1 public class Hello 2 { 3 public static void main(String[] args) 4 { 5 // display a greeting in the console window 6 System.out.println("Hello, World!"); 7 } 8 }
  • 10. Java Program Elements  A Java program is made up of class definitions.  A class definition must contains a header and a body.  A class contains zero or more methods  A method is a named section of code that also has a header & body  A method contains program statements  Single-line (starts with //) and multi-line (enclosed by /* and */) comments are used to document the code
  • 11. Java Program Structure public class Hello { } // comments about the class class header class body //Comments can be placed almost anywhere
  • 12. Java Program Structure public class MyProgram { } // comments about the class public static void main (String[] args) { } // comments about the method method header method body
  • 13. Compiling and Running  Type program into text editor  Save (file name must be similar to class name)  Open Dos Window  Change directory to saved file directory  Compile into byte codes javac Hello.java  Execute byte codes java Hello
  • 14. Processing a Java Program
  • 15. Class Loader  A Java program typically consists of several pieces called classes.  Each class may have a separate author and each is compiled (translated into byte-code) separately.  A class loader (called a linker in other programming languages) automatically connects the classes together and loads the compiled code (bytecode) into main memory.
  • 16. Creating a Java Program… JVM Create/modify source code Source code Compile source code Byte code Run byte code Output Syntax errors Runtime errors or incorrect results
  • 17. Errors  It is common for programmer to make mistake in a program.  Three kinds of errors  Syntax errors  Runtime errors  Logic errors
  • 18. Syntax Errors  Grammatical mistakes in a program  The grammatical rules for writing a program are very strict  The compiler catches syntax errors and prints an error message.  Example: using a period where a program expects a semicolon  System.out.print("..."),  System.out.print("Hello);
  • 19. Runtime Errors  Errors that are detected when your program is running, but not during compilation  When the computer detects an error, it terminates the program and prints an error message.  Example: attempting to divide by 0
  • 20. Logic Errors  Errors that are not detected during compilation or while running, but which cause the program to produce incorrect results  Example: an attempt to calculate a Fahrenheit temperature from a Celsius temperature by multiplying by 9/5 and adding 23 instead of 32  E.g  System.out.print("Hell");