CHAPTER 8
METHODS
232
public Date end() {
return end;
}
...
// Remainder omitted
}
At first glance, this class may appear to be immutable and to enforce the
invariant that the start of a period does not follow its end. It is, however, easy to
violate this invariant by exploiting the fact that
Date
is mutable:
Do'stlaringiz bilan baham: