java语言程序设计基础篇答案Chapter 10 Thinking in Objects
1. No. It must also contain no get methods that would return a reference to a mutable data field object.
2. Yes.
3. No, because values is a reference type.
4. No. The Loan class has the getLoanDate() method that returns loanDate. loanDate is an object of the Date class. Since Date is mutable, the contents of loanDate can be changed. So, the Loan class is not immutable.
5.i + j is 23 (because i (value of 2) is concatenated with string j + j is, then j (value of 3) is concatenated with string i + j is 2.)
k is 2
j is 0
6.
Swap line 5 with line 6
Lines 10, 14, should be this.p = p;