This content has been marked as final. Show 3 replies
Because the people who specified and implemented the Generics features in Java didn't do that.
and I'm not sure it makes sense since then many of access methods would need need to be able to return/accept either something that extends Integer or a String.
Why there is no way to define or logical restriction for generic types?Because there is no way to use the resulting code, unless there is a common base class or interface, in which case that is what you should specify, which is why the language only gives you a way to do that.