chapter_5_beginning_javabook

In the declaration above the name of the variable is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ch variable. In the declaration above, the name of the variable is integer_from_keyboard. Variable declarations, like all Java statements, must be terminated with a semicolon (;). Program Game.java, presented as a program description on the following page opening, is an example program where two variables of type int are declared and used. The program is an extremely simple computer game. Unfortunately it is not a fair game because the user of the program will always lose. The program always wins by presenting an integer that is one larger than the number given by the user of the program. A source program like Game.java is a text file in a computer's hard disk memory before it is compiled. When a source program is compiled, we get an executable version of the program. The compiler is a computer tool that can convert a source program into executable form. The compiler reads and processes a source program file in the same order in which it is written. While compiling program Game.java, the compiler sees first the variable declarations and reserves main memory for th...
View Full Document

Ask a homework question - tutors are online