Alice has $125.00 Bob can withdraw $125.00? false Bob can withdraw $25.00? true Bob has $75.00 Charlie can withdraw $25.00? true Charlie has $100.00 Alice has $100.00 After transfer... Charlie has $100.00 Alice has $100.00
This account has $60.00
(new Account(60))evaluates to an account object reference, and the toString method is then called on that object.
foohas not been initialized before line 2, so execution would result in a null pointer exception. (In this case, the compiler may complain that
foohas not been initialized. To correct the problem, one could create an account object, for example by adding the line
foo = new Account(50);after line 1. (Alternatively, one could replace line 1 by
Account foo = new Account(50);to correct the error.)