I think your question is more about protected access than about the clone
method itself. As far as class Integer is concerned, Method clone is just an
another example of a proteced method. So, we could as easily use the following
example:
Your question then is why can't you do the following:
But do you understand why that line violates protected
access if it is written in a class outside package widget?
Going back to Integer, one could also ask, "why isn't the clone method in
Integer public?". (The original post was rather vague and it's not clear
what was really being asked there.) Well, Integer is an example of an
immutable class, like
String, so there is no reason to clone instances!