Java Reference
In-Depth Information
The remainder of this first program consists of two closing braces. The first closing
brace ends the definition of the method main . The last closing brace ends the definition
of the class named FirstProgram .
Self-Test Exercises
1. If the following statement were used in a Java program, it would cause something
to be written to the screen. What would it cause to be written to the screen?
System.out.println("Java is not a drink.");
2. Give a statement or statements that can be used in a Java program to write the
following to the screen:
I like Java.
You like tea.
3. Write a complete Java program that uses System.out.println to output the
following to the screen when run:
Hello World!
Note that you do not need to fully understand all the details of the program in order
to write the program. You can simply follow the model of the program in Display 1.1.
Byte-Code and the Java Virtual Machine
Most modern programming languages are designed to be (relatively) easy for people
to write and to understand. These languages are called high-level languages . The
language that the computer can directly understand is called machine language .
Machine language or any language similar to machine language is called a low-level
language . A program written in a high-level language, such as Java, must be translated
into a program in machine language before the program can be run. The program that
does the translating (or at least most of the translating) is called a compiler and the
translation process is called compiling .
high-level,
low-level, and
machine
languages
compiler
Compiler
A compiler is a program that translates a high-level-language program, such as a Java
program, into an equivalent low-level-language program.
One disadvantage of most programming languages is that the compiler translates
the high-level-language program directly into the machine language for your computer.
Since different computers have different machine languages, this means you need a
different compiler for each type of computer. Java, however, uses a slightly different
and much more versatile approach to compiling.
 
Search WWH ::




Custom Search