For example, if I have the following class:
class MyObject<T> {}
Why is this possible:
class Main {
public static void main(String[] args) {
MyObject<MyObject<?>> moMo = new MyObject<MyObject<?>>();
}
}
but not this:
class Main {
public static void main(String[] args) {
MyObject<?> mo = new MyObject<?>();
}
}
I don't understand why one of these would be possible and not the other. I'm starting to believe that these many little discrepancies weren't intentionally designed, but are instead just quirks in the language.
I understand there have been similar questions asked on here (this, this, and this); however, none have answered why one is allowed and not the other.