Java Reference
In-Depth Information
plus signs (+)
concatenate data
in single output
line of code
closing brace
for main()
method block
output code
Math.round()
method rounds
to integer
closing brace
for class block
FIGURE 3-20
The program now is complete. You coded the documentation; the opening
class and method headers; the declaration of variables; the prompts, inputs, and
conversions; the calculations; and the output. Check the code to ensure that the
syntax, spelling, capitalization, and indentations are correct. When you are confi-
dent everything is correct, you are ready to save and compile your program.
Compiling, Running, and Documenting
the Application
The Java source code for the Body Mass Index Calculator program must be
compiled before it can be executed and tested. Once the program is running cor-
rectly, it is a good idea to print a copy of the source code for documentation.
Compiling the Source Code
Recall that the compiler automatically saves the program and then translates
the source code into Java bytecode. To compile the program, you will use the
Compile Java command on TextPad's Tools menu, as shown in the step on the
next page.
 
Search WWH ::




Custom Search