Programming and Problem Solving with Java

(やまだぃちぅ) #1
1.5 What Kinds of Instructions Can Be Written in a Programming Language? | 15

Source
code

Code listing,
possibly with
error messages

Machine language
version of
source code
(object code)

Input
data Results

Computer executes
machine language
version of
source code

Computer executes
COMPILATION compiler code

EXECUTION

Loading

Figure 1.7 Compilation/Execution


ply to illustrate the difference between the traditional compile–execute steps and the com-
pile–interpret steps used with Java.
Viewed from a different perspective, the JVM makes the computer look like
a different computer, one that has Bytecode as its machine language. The com-
puter itself hasn’t changed—it remains the same collection of electronic cir-
cuits—but the JVM makes it appearto be a different machine. When a program is
used to make one computer act like another computer, we call it a virtual machine.
For convenience, we may refer to the computer as “executing a Java application,”
but keep in mind this is just shorthand for saying that “the computer is execut-
ing the JVM running a Java application.”


1.5 What Kinds of Instructions Can Be Written in a Programming


Language?


The instructions in a programming language reflect the operations a computer can perform:


 A computer can transfer data from one place to another.
 A computer can input data from an input device (a keyboard or mouse, for exam-
ple) and output data to an output device (a screen, for example).

Virtual machine A program
that makes one computer act
like another
Free download pdf