Math class being an option for immutable classes !!
Enthuware - Best Mock Exams and Questions for Oracle Java Certifications
Quality Guaranteed - Pass or Full Refund!
Originally posted by Valentin Crettaz:
You can find out if a class is immutable by looking at its API. If you can't find any method with which you could change its internal state (i.e. the value of its member variables and the one inherited from the superclasses) then you may deduce that the class is immutable. That is the class has no "mutator" methods, which means you cannot mutate (change) the state of the object. It may have "accessor" method (to access its internal state) though. Mutator are often method beginning with "set..." and accessor with "get..."
Consider Paul's rocket mass heater. |