Java Reference
In-Depth Information
the very earliest computers worked. However, a long program is composed of
thousands of individual commands, and it is tedious and error-prone to look up the
numeric codes for all commands and manually place the codes into memory. As we
said before, computers are really good at automating tedious and error-prone activities,
and it did not take long for computer programmers to realize that computers could be
harnessed to help in the programming process.
Because machine instructions are encoded as numbers, it is difficult to write
programs in machine code.
In the mid-1950s, high-level programming languages began to appear. In these
languages, the programmer expresses the idea behind the task that needs to be
performed, and a special computer program, called a compiler, translates the
high-level description into machine instructions for a particular processor.
High-level languages allow you to describe tasks at a higher conceptual level than
machine code.
For example, in Java, the high-level programming language that you will use in this
topic, you might give the following instruction:
if (intRate > 100)
System.out.println("Interest rate error");
This means, ȒIf the interest rate is over 100, display an error messageȓ. It is then the
job of the compiler program to look at the sequence of characters if (intRate >
100) and translate that into
21 40 16 100 163 240 . . .
Compilers are quite sophisticated programs. They translate logical statements, such as
the if statement, into sequences of computations, tests, and jumps. They assign
memory locations for variablesȌitems of information identified by symbolic namesȌ
like intRate . In this course, we will generally take the existence of a compiler for
granted. If you decide to become a professional computer scientist, you may well learn
more about compiler-writing techniques later in your studies.
Search WWH ::




Custom Search