|
|
|
Data Types |
|
Operators |
|
Control Flow Statements |
|
Arrays |
|
Functions -- Static Methods |
|
View Classes as modules |
|
|
|
|
|
|
|
|
|
|
byte,short,int,long |
|
float,double |
|
char |
|
boolean |
|
reference |
|
array |
|
object |
|
|
|
|
Arithmetic operators
+, -, *, /, %, ++, -- |
|
Relational operators
>, >=, <, <=, ==, != |
|
Conditional operators
&&, ||, ! |
|
Bitwise operators
>>, <<, >>>, &, |, ^, ~ |
|
|
|
|
|
decision making |
|
if-else, switch-case |
|
loop |
|
for, while, do-while |
|
exception |
|
try-catch-finally, throw |
|
miscellaneous |
|
break, continue, label: , return |
|
|
|
|
Dynamic |
|
Anonymous array |
|
a.length |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Java language constructs |
|
types |
|
operators |
|
control statements |
|
arrays |
|
View classes as modules of functions |
|
static methods |
|
|
|
|
|
|
|
How to write functions that return multiple
values |
|
In C, use pointers |
|
In Java, use objects |
|
|
|
|
|
|
|
Java |
|
|
|
|
|
|
|
|
|
Call by reference |
|
actual argument is updated |
|
|
|
C |
|
|
|
|
|
|
|
|
|
Call by value |
|
actual argument does not change |
|
|
|
|
|
|
|
|
static Point center(Rectangle r) |
|
return the center point of r. |
|
static int area(Rectangle r) |
|
return the area of r. |
|
static boolean isCenter(Rectangle r, Point p) |
|