We have made this class as immutable:
- The class is final. That means no subclasses can be created. A subclass of an immutable class can be made mutable again. As noted above, an attacker could use that to get to confidential data.
- The variables are all final and cannot be changed after construction
- In the constructor we use the
import org.joda.time.DateTime
class. This is a better version than thejava.util.Date
because it is immutable. Using ajava.util.Date
would be dangerous as it is a mutable class and we can’t control the calling thread (which might modify it). - There are no setter methods for the members.
Cool and thanks for the update as well and do let me know
where can I get the best java classes online also as I was searching youtube and several
videos on google also came across this online course also
http://www.wiziq.com/course/20626-the-6-week-complete-java-primer-may-batch I want to start as
soon as possible but was wondering if this works for me.
LikeLike