Unformatted text preview: used to write statements. • The program is written by translating the algorithm steps into a programming language statements.
• The written program is called Source code and it is
saved in a file with “.java” extension.
Coding Translating Program
Page 14 Pseudocode Source Code
(The “.java”) Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Why Coding in Programming
• We write computer programs (i.e. a set of instructions) in programming languages such
as C, C++, and Java. • We use these programming languages because they are easily understood by
humans • But then how does the computer understand the instructions that we write? Page 15 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Compiling Computer Programs
• Computers do not understand programs written in programming languages such as
C++ and Java
• Programs must first be converted into
machine code that the computer can run
• A Software that translates a programming
language statements into machine code is
called a compiler
Program Source code Compiling Translating Machine code Machine Code
Page 16 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Programming Language Compiler
• A compiler is a software that:
– Checks the correctness of the source code
according to the language rules.
• Syntax errors are raised if some rules were
violated. – Translates the source code into a machine
code if no errors were found. Page 17 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Platform dependent Compiling
• B ecause different p latforms , or hardware architectures along with the operating systems
(Windows, Macs, Unix), require different
machine code, you must compile most
programs separately for each platform. Page 18 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Compiling Java Programs
• The Java compiler produces bytecode (a “.class” file) not machine code from the source code (the “.java” file).
• Bytecode is converted into...
View Full Document
This document was uploaded on 03/03/2014.
- Spring '14