February 2014
Beginner
1248 pages
62h 25m
English
Method testPushInteger (lines 62–73) invokes Stack method push to place values onto integerStack until it’s full. Method testPopInteger (lines 76–96) invokes Stack method pop to remove values from integerStack. Once again, the values are popped in lastin, first-out order. During erasure, the compiler recognizes that the client code in method testPopInteger expects to receive an int when method pop returns. So the compiler inserts an Integer cast, as in
popValue = (Integer) stack.pop();
The value assigned to popValue will be unboxed from the Integer object returned by pop.
Read now
Unlock full access