













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














1
2
3
4
7
8
9
10
13
14
etc. 15
16
A memory cell that contains the memory address of the data for
19
bobsCar
20
If an object has two (or more) aliases, the object may be referenced and/or modified through any of those aliases.
bobsCar.accelerate(5); int currentSpeed = bobsCar.getSpeed();
21
int currentSpeed bobsCar.getSpeed(); if (bobsCar.getFuelLevel() < 0.1) bobsCar.decelerate(10);
22
bobsCar.accelerate(5); int currentSpeed = bobsCar.getSpeed(); if (bobsCar.getFuelLevel() < 0.1) bobsCar.decelerate(10);
bobsCar “Sedan”
2000
suesCar “SUV” 2001
25
bobsCar “Sedan”
2000
suesCar “SUV” 2001
26
other 0. 35 9864
bobsCar “Sedan”
2000
suesCar “SUV” 2001
27
other 0. 55 9864
bobsCar “Sedan”
2000
suesCar “SUV” 2001
28
other 0. 55 9864
bobsCar “Sedan”
2000
suesCar “SUV” 2001
31
bobsCar “Sedan”
2000
suesCar “SUV” 2001
32
other 0. 35 9864
suesCar “SUV” 2001
bobsCar “Sedan” (^) otherCar “SUV”
memory location
other 0. 35 9864
33
bobsCar Sedan 2000
55 21405
otherCar SUV 2001
55 9864
suesCar “SUV” 2001
f d l i t
bobsCar “Sedan” otherCar “SUV”
other 0. 35 9864
referenced no longer exist
Memory allocated by new is garbage
34
otherCar SUV 2001
55 9864
bobsCar Sedan 2000
55 21405
Primitive Class Wrapper Class byte Byte boolean Boolean char Character double Double
37
float Float int Integer long Long short Short
int size = 42; Integer sizeWrapper = new Integer(size); String sizeString = sizeWrapper.toString();
Integer
38
Integer size = 42 value = 42
39
Integer i = 42; // auto-boxing // same as Integer i = new Integer(42)
40
int x = i; // auto-unboxing // same as int x = i.intValue();