Answer the question
In order to leave comments, you need to log in
What to do with type parameter during inheritance?
And so there is a superclass with a type parameter, let's say SuperClass<T>
a subclass inherits from it. Also what at such inheritance to do with type parameter? Does a subclass need to declare its own type parameter? Eg. SubClass<T> extends SuperClass
. How to be at creation of instances?
Answer the question
In order to leave comments, you need to log in
Depends on the subclass.
If it's as generic as the superclass, it's written like this:
Can inherit a particular specialization of the superclass:
Can do like this:
P.S. I advise you to spend your time and read thoughtfully docs.oracle.com/javase/tutorial/java/generics/, or resp. chapter in any Java textbook. Then save a lot of time on plugs like this (but it can be worse with generics).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question