I'm doing a Java course. Having gone through the use of accessor
(setter and getter) methods for instance variables, it goes on to say:
"For reasons that cannot be elaborated upon here, it is safer, where
possible, to initialise instance variables directly in a constructor
rather than using setter messages."
Can anyone offer a simple explanation for this?
--
Nigel M
(setter and getter) methods for instance variables, it goes on to say:
"For reasons that cannot be elaborated upon here, it is safer, where
possible, to initialise instance variables directly in a constructor
rather than using setter messages."
Can anyone offer a simple explanation for this?
--
Nigel M
Comment