Question 2-3

What does the following method print?

import csbsju.cs160.*;

public class Q3 {
    public static void run() {
        Account a = new Account();
        a.deposit(2.0);
        Account b = new Account();
        b.deposit(4.0);
        Account c = b;
        b = a;
        b.deposit(8.0);
        IO.println(a.getBalance());
        IO.println(b.getBalance());
        IO.println(c.getBalance());
    }
}

Solution

10.0
10.0
4.0

Back to 8:00 Quiz 2