Primitive and Object Variables
- Variables are represented on the stack as either:
- A built-in primitive type (byte, short, int, long,
char, float, double, or boolean)
uses value semantics
int i = 42; /* i holds value (42) */
- An object type (extended from java.lang.Object)
uses reference semantics (like a pointer)
Button helpButton = new Button("Help");
/* helpButton is an object ref */
|