13 X 11 Pass by Value class Demo { /* Code for testMachine here*/ public static void Main(String args[]) { int i = 3; CokeMachine cm; cm = new CokeMachine(); exerciseMachine(i, cm); } i: cm: 3 Object: CokeMachine numCans = 0 Object: CokeMachine numCans = 0 main: testMachine: n: cm: 0 public static void testMachine (int n, CokeMachine cm) { for(int i=0; i < n; i++) { cm.vend(); } n = 0; // Just to be mean cm = null; // and nasty.
{}