Because the two Kettle classes are encapsulated users of the class cannot tell whether the temperature is maintained by the Kettle or a Water object. And they don't care. They know that calling boil() on a Kettle instance will set its temperature to 100°C and calling empty() will set the amount of water to 0. That's all they need to know.
Joined: Jul 15, 2009
Thank you Campbell,
I have one more query regarding Threads
How can we make a method thread-safe (but in terminology we are talking about classes as thread safe) by declaring it as static, i know about synchronized concept but is it possible to make thread safe with only static key word.