chapter_5_beginning_javabook

The general structure of the programs is the

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: variables. The general structure of the programs is the following: import java.util.* ; These lines are present only in those programs which read data from the keyboard. class ClassName { public static void main( String not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; Variable declarations. Action statements that modify and print the contents of the variables that were declared above. } } As was already discussed in Chapter 2, the structure of our first programs is such that a static method named main() contains the action statements of the program, and the main() method is written inside a class declaration. At this phase, we do not attempt to profoundly understand the meaning of the class declaration. We’ll just try to figure out how the internal statements of method main() operate. 100 Chapter 5: Variables and other basic elements in Java programs 5.1 Integer variables (int, short, long, byte, char) A variable in a source program is a basic program element that can be used to store a numerical va...
View Full Document

This document was uploaded on 01/20/2014.

Ask a homework question - tutors are online