...
Code Block |
---|
final class Book { // May change its locking policy in the future to use private internal locks private final String title; private Calendar dateIssued; private Calendar dateDue; Book(String title) { this.title = title; } public synchronized void issue(int days) { dateIssued = Calendar.getInstance(); dateDue = Calendar.getInstance(); dateDue.add(Calendar.DAY_OF_MONTHdateIssued.DATE, days); } public synchronized Calendar getDueDate() { return dateDue; } } |
...