Abdelilah Elghazal Abdelilah Elghazal - 2 years ago 66
Java Question

How to extend class<T extends class>

I want to extend a Class that already has

<T extends class>
in it.
For example, I want to extend this class named Foo:

public class Foo<T extends OtherClass>{


How do I do this?
I tried this but it is not working:

public class MyClass<T extends OtherClass> extends Foo{


Thanks in advance <3

Answer Source

The syntax you're looking for is

public class myClass<T extends otherClass> extends foo<T> {

If you want to extend it with a specific type of T:

public class myClass extends foo<Bar> {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download