Henry Wong wrote:
tanisha Murthy wrote:Then in that case whatever we specify in place of <String>, like <Integer> or <Float> would be resulting in compiler error, because compiler will not know the unknown type is correct or not.
Which is why, in the case of <? extends Object>, you can't add() anything -- except for null. The compiler can't verify the type.
It is a bit different when it is a "super" bounded wildcard, as the compile can check it, even if it is unknown.
Henry
Henry Wong wrote:Is there a question somewhere?
Henry