|
Review of Some Programmatic basics
Operators
Loops
For loop that counts from 0 to 10
for (int i = 0; i < 10 ; i++){
System.out.println(“loop is at “ + i);
}
|
While loop that counts from 0 to 10
int counter = 0;
while(counter < 10)
{
counter++;
System.out.println(“loop is at “ + counter);
} |
Operator Precedence
In our class, we only need to worry about the bottom three rows.
| Precedence |
Operator |
Operation |
Associates |
| 1 |
+
−
|
Unary Plus
Unary Minus
|
R to L |
| 2 |
*
/
%
|
multiplication division remainder |
L to R |
| 3 |
+
−
+
|
addition subtraction String concatenation |
L to R |
| 4 |
= |
assignment |
R to L |
Relational Operators
| Symbol |
Meaning |
Usage |
| < |
less than |
if(3 < 4) (true) |
| ≤ |
less than or equal to |
if (4 ≤ 4) (true) |
| > |
greater than |
if (4 > 0) (false) |
| ≥ |
greater than or equal to |
if (4 ≥ 4) (true) |
Top
|