Donnerstag, 11. Dezember 2008

EE3206 java: immutable class

EE3206/EE5805

Java Programming and Application
notes Liang (2009),
p.333

Three requirement for an immutable class

1. declare all fields private

2. provide no set() methods

3.Provide no accessor methods that returns a reference to a data field that is mutable. eg .return a Date object.



Keine Kommentare: