



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
5
6
7
8
9
11
12
19
address of the data forcontains the memoryA memory cell that bobsCar 20
Automobile myCar = bobsCar;
If an object has two (or more) aliases,the object may be referenced and/ormodified through any of those aliases.
21
bobsCar.accelerate(5);intif (bobsCar.getFuelLevel() <currentSpeed = bobsCar.getSpeed(); 0.1) bobsCar.decelerate(10); 22
if (^) bobsCar.decelerate(10);(bobsCar.getFuelLevel() < 0.1)
23
24
publicint diff void matchSpeed(Automobile = getSpeed() - other.getSpeed(); other) { }if(diff > 0)else^ other.decelerate(-diff);^ other.accelerate(diff);
25
bobsCar 2140555
“Sedan” (^) suesCar 986435
26
bobsCar 2140555
“Sedan” other suesCar 986435
27
bobsCar
2140555
“Sedan” other suesCar 986455
28
bobsCar 2140555
“Sedan” other suesCar 986455
29
publicotherCar void matchSpeed(Automobile = new Automobile(other.getModel(),other.getYear(), other) { other.getFuelLevel(),getSpeed(),other.getMileage()); }
37
shortlong ShortLong intfloat IntegerFloat doublechar DoubleCharacter booleanbyte BooleanByte Primitive Class Wrapper Class
38
Integer String sizeStringsizeWrapper = = sizeWrapper.toString(); new Integer(size); size = 42 value = 42^ Integer
39
40
// int same x = as Integeri; // auto-unboxing i = new Integer(42) // same as int x = i.intValue();
41
Let’s look at the steps that this involves:1. Auto-unbox d into a double 2.3. Add 1Auto-box the result into a new Double