2.1 The Parts of a Java Program
method header
The first line of a method.
class header or class definition
describes a class; it contains an optional access modifier, the keyword class, and any legal identifier for the name of the class
public
is a Java key word, and it must be written in all lowercase letters. It is known as an access specifier, and it controls where the class may be accessed from.
Every complete Java programming statement ends with a _____.
semicolon ;
string literal
the group of characters inside the quotation marks. This is the only line in the program that causes anything to be printed on the screen.
.java
the names of Java source code files end with .java.
class
which must also be written in lowercase letters, is a Java key word that indicates the beginning of a class definition.
;
Semicolon. Marks the end of a complete programming statement.
All Java source code filenames must end with _____.
.java
Suppose the class named "Columbus" in this section is saved as a java source file. What should the file be named? Include the appropriate extension.
Columbus.java
//
Double slash. Marks the beginning of a comment.
semicolon
Just as a period marks the end of a sentence, a semicolon marks the end of a statement in Java.
{ }
Opening and closing braces. Encloses a group of statements, such as the contents of a class or a method.
( )
Opening and closing parentheses. Used in a method header.
" "
Quotation marks. Encloses a string of characters, such as a message that is to be printed on the screen.
A left brace in a Java program should always be followed by a right brace later in the program.
True
Every Java application program must have _____.
a method named main
In Java, a group of statements, such as the contents of a class or a method, is enclosed in _____.
braces {}