Question 2-2

The following program uses the Account class we defined in class.

import csbsju.cs160.*;

public class PrintHello {
    public static void main(String[] args) {
        Account a = new Account();
        a.deposit(80.0);
        Account b = a;
        b.withdraw(20.0);
        b = new Account();
        b.deposit(40.0);
        IO.println(a.getBalance());
    }
}
What does this program print?

Solution

60.0

Back to Review for Quiz 2