Java Reference
In-Depth Information
Finally, add a method refuseHelp to the Greeter class. It should
return a string such as ÑI am sorry, Dave. I am afraid I
can't do that.Ñ
Test your class in BlueJ. Make objects that greet the world and Dave,
and invoke methods on them.
130
131
ANSWERS TO SELF-CHECK QUESTIONS
1. The programmers who designed and implemented the Java library.
2. Other programmers who work on the personal finance application.
3. harrysChecking.withdraw(harrysChecking.getBalance())
4. Add an accountNumber parameter to the constructors, and add a
getAccount-Number method. There is no need for a
setAccountNumber methodȌthe account number never changes after
construction.
5.
/**
Constructs a new bank account with a given
initial balance.
@param accountNumber the account number for
this account
@param initialBalance the initial balance for
this account
*/
6. The first sentence of the method description should describe the methodȌ
it is displayed in isolation in the summary table.
7. An instance field
private int accountNumber;
needs to be added to the class.
8. You can't tell from the public interface, but the source file (which is a part
of the JDK) contains these definitions:
Search WWH ::




Custom Search