Java Tutorial
Expressions:
An expression is a construct made up of variables, operators, and method invocations
Example: result = 1 +2; name=‘linfeng’;
Statements:
Statements are roughly equivalent to sentences in natural languages. A statement forms a complete unit of execution.
- Assignment expressions
- Any use of ++ or --
- Method invocations
- Object creation expressions
// assignment statement
aValue = 8933.234;
// increment statement
aValue++;
// method invocation statement
System.out.println("Hello World!");
// object creation statement
Bicycle myBike = new Bicycle();
Fields: an object stores its state in fields
Class Variables (Static Fields) :
A class variable is any field declared with the static modifier; this tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated.
Instance Variables (Non-Static Fields) :
Technically speaking, objects store their individual states in "non-static fields", that is, fields declared without the static keyword. Non-static fields are also known as instance variables because their values are unique to each instance of a class (to each object, in other words)
Local Variables:
a method will often store its temporary state in local variables. that determination comes entirely from the location in which the variable is declared — which is between the opening and closing braces of a method.
only visible to the methods in which they are declared;
Parameters:
Parameters are variables that provide extra information to a method;
both local variables and parameters are always classified as "variables" (not "fields")
Argument:
Real data passing to the methods;
Members:
A type's fields, methods, and nested types are collectively called its members.