Java Reference
In-Depth Information
TABLE 1-2 Examples of Instructions in Assembly Language and Machine Language
1
Assembly Language
Machine Language
LOAD
100100
STOR
100010
MULT
100110
ADD
100101
SUB
100011
Using assembly language instructions, you can write the equation to calculate the weekly
wages as follows:
LOAD
rate
MULT
hours
STOR
wages
As you can see, it is much easier to write instructions in assembly language. However, a
computer cannot execute assembly language instructions directly. The instructions first
have to be translated into machine language. A program called an assembler translates
the assembly language instructions into machine language.
Assembler: A program that translates a program written in assembly language into an
equivalent program in machine language.
Moving from machine language to assembly language made programming easier, but a
programmer was still forced to think in terms of individual machine instructions. The
next step toward making programming easier was to devise high-level languages that
were closer to spoken languages, such as English and Spanish. Basic, FORTRAN,
COBOL, Pascal, C, C++, and Java are all high-level
languages. You will
learn the
high-level language Java in this topic.
In Java, you write the weekly wages equation as follows:
wages = rate * hours;
The instruction written in Java is much easier to understand and is self-explanatory to a
novice user who is familiar with basic arithmetic. As in the case of assembly language,
however, the computer cannot directly execute instructions written in a high-level
language. To run on a computer, these Java instructions first need to be translated into
an intermediate language called bytecode and then interpreted into a particular machine
language. A program called a compiler translates instructions written in Java into
bytecode.
Compiler: A program that translates a program written in a high-level language into the
equivalent machine language. (In the case of Java, this machine language is the bytecode.)
Search WWH ::




Custom Search