Statements
- Declaration Statements:
type variable-name ;
- Assignment Statements:
variable-name = value ;
- Method Invocation Statements:
variable-name.methodname(arguments);
Types
- Primitive:
int, char, byte, double
- Reference:
class, array, interface
- Objects belong to a class, or are arrays, whereas
variables have types. Assigning a reference to an object
into a variable depends on the class of the object being
compatible with the type of the variable, or that the
class implements the interface type of the variable, etc.
Variables
- its name,
- its type,
- its lifetime,
- and its scope.
Control Constructs
The four fundamental constructs of control of flow in a
program are:
- straight line: the automatic movement from statement to statement,
top down in a program;
- method invocation: the jumping away into a new piece of code, the
method (function), along with the loading of arguments into the method's
local variables, and the subsequent return to the jump point, possibly
inserting the return value as the evaluation of the methdo call;
- branch: either one piece of code or another is executed using the
if and the if else constructs;
- looping: a section of code is run repeatedly based on a logical control
statement at the top or bottom of the code section - such as the while, do whileand for loops.