Java Reference
In-Depth Information
How conditional statements and loop constructs are implemented in
Java
n
An introduction to the static method —the Java equivalent of the
function and procedure that is used in non-object-oriented languages
n
the general environment
1.1
How are Java application programs entered, compiled, and run? The answer,
of course, depends on the particular platform that hosts the Java compiler.
Java source code resides in files whose names end with the .java suffix.
The local compiler, javac , compiles the program and generates .class files,
which contain bytecode. Java bytecodes represent the portable intermediate
language that is interpreted by running the Java interpreter, java . The inter-
preter is also known as the Virtual Machine .
For Java programs, input can come from one of many places:
javac compiles
.java files and gen-
erates .class files
containing
bytecode. java
invokes the Java
interpreter (which is
also known as the
Virtual Machine ).
The terminal, whose input is denoted as standard input
n
Additional parameters in the invocation of the Virtual Machine—
command-line arguments
n
A GUI component
n
A file
n
Command-line arguments are particularly important for specifying pro-
gram options. They are discussed in Section 2.4.5. Java provides mechanisms
to read and write files. This is discussed briefly in Section 2.6.3 and in more
detail in Section 4.5.3 as an example of the decorator pattern . Many operat-
ing systems provide an alternative known as file redirection , in which the
operating system arranges to take input from (or send output to) a file in a
manner that is transparent to the running program. On Unix (and also from an
MS/DOS window), for instance, the command
java Program < inputfile > outputfile
automatically arranges things so that any terminal reads are redirected to
come from inputfile and terminal writes are redirected to go to outputfile .
 
 
Search WWH ::




Custom Search