Java Reference
In-Depth Information
Table 1.2
Units of Memory Storage
Measurement
Power of 2
Actual Value
Example
2 10
kilobyte (KB)
1,024
500-word paper (3 KB)
2 20
megabyte (MB)
1,048,576
typical book (1 MB) or song
(5 MB)
2 30
gigabyte (GB)
1,073,741,824
typical movie (4.7 GB)
2 40
terabyte (TB)
1,099,511,627,776
20 million books in the
Library of Congress (20 TB)
2 50
petabyte (PB)
1,125,899,906,842,624
10 billion photos on
Facebook (1.5 PB)
The Process of Programming
The word code describes program fragments (“these four lines of code”) or the act of
programming (“Let's code this into Java.”). Once a program has been written, you
can execute it.
Program Execution
The act of carrying out the instructions contained in a program.
The process of execution is often called running. This term can also be used as a
verb (“When my program runs it does something strange”) or as a noun (“The last
run of my program produced these results”).
A computer program is stored internally as a series of binary numbers known as
the machine language of the computer. In the early days, programmers entered num-
bers like these directly into the computer. Obviously, this is a tedious and confusing
way to program a computer, and we have invented all sorts of mechanisms to sim-
plify this process.
Modern programmers write in what are known as high-level programming lan-
guages, such as Java. Such programs cannot be run directly on a computer: They first
have to be translated into a different form by a special program known as a compiler.
Compiler
A program that translates a computer program written in one language
into an equivalent program in another language (often, but not always,
translating from a high-level language into machine language).
A compiler that translates directly into machine language creates a program that
can be executed directly on the computer, known as an executable . We refer to such
compilers as native compilers because they compile code to the lowest possible level
(the native machine language of the computer).
This approach works well when you know exactly what computer you want to use
to run your program. But what if you want to execute a program on many different
 
Search WWH ::




Custom Search