If I define the following class
public class SomeClass<T extends A> {..}
I of course can’t define a variable this way – B is unrelated class.
SomeClass<B> instance = new SomeClass<B>();
But this works:
SomeClass instance = new SomeClass();
What am I missing?
Generics in Java are optional.
If you use them, you have to use them “properly”.
But if you don’t use them at all, it will compile just fine (but you miss out on the type-safety features they provide, and should be getting a compile-time warning about it).