java generics, how to extend from two classes? -
i want have class object, want force whatever class represents extend class , class b. can do
<t extends classa & classb>
but not possible extend both classes, there way this?
in java cannot have class extends 2 classes, since doesn't support multiple inheritance. can have, so:
public class ... public class b extends ... public class c extends b ...
in generic signature, can specify t
must extend c
: <t extends c>
.
you give @ default methods
(if working java 8), methods declared within interfaces, , in java, class can implement multiple interfaces.
Comments
Post a Comment