Mutable and Immutable Objects Revisited
with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
public
or private
final
or notfinal
public
or
private
(depending on the methods
included in the class)final
or
private
(or both)
This implementation isn't safe if the width
and the
height
can't be negative.
Rectangle
Class
Rectangle
Class
final
?
private
!
Rectangle
Class
Rectangle
Class
Rectangle
Class