Introduction to Java Flashcards
(145 cards)
In the java programming language:
A program is made up of ________ classes
one or more
In the java programming language:
A program is made up of ________ , methods
one or more
A method contains
program statements
Anatomy of a Java Program:
Comments Reserved words Modifiers Statements Blocks Classes Methods The main method
How do you structure a class?
//comments about the class public class classHeader {
//class body
}
How do you structure a method?
//comments about the class public class classHeader {
public static returnType name(|inputType| tempName) { //method body }
}
Comments in a program are called…
They should be included to…
inline documentation, explain the purpose of the program and describe processing steps
How are comments structured?
// this comment runs the end of line
/* this comment runs to the terminating symbol */
/** comment */
Identifiers are…
the words that a programmer use in a program
Identifiers can be made up of…
letters, digits, underscore and $
Identifiers cannot begin with…
a digit
Java is case…
sensitive
White space includes…
spaces, blank lines, tabs
White spaces are used to…
separate words and symbols in a program and make the program more readable along with indentation
Extra white spaces are
ignored
Reserved words called modifiers are used to
specify properties of the data, methods and classes and how they can be used
private, final, public and static are examples of
modifiers
A statement…
represents an action or a sequence of actions
A statement ends in
;
Blocks can be identified with…
{
}
The syntax rules of a language define…
how we can put together symbols, reserved words, and identifiers to make a valid program
The semantics of a program is…
what the programmer intends the program to achieve/do
A program that is syntactically correct does not mean it is
semantically/logically correct
The three types of errors in java are
- Compile time errors
- Run-time errors
- Logical errors