5

Is there a logical reason why E cannot implement my interface HasName?

public class SinglyLinkedList<E extends HasName> {
    // stuff...
}
letter Q
  • 14,735
  • 33
  • 79
  • 118

1 Answers1

16

The extends keyword applies to interfaces too. That is:

public class SinglyLinkedList<E extends HasName> {

Means that E must be a type that extends a class, or implements an interface, called HasName.

It is not possible to code E implements HasName - that is implied by E extends HasName.

Bohemian
  • 412,405
  • 93
  • 575
  • 722
  • 1
    This much more clear for rookies like me than the answer in the original question it's marked duplicate of. – Kid101 Jul 25 '18 at 17:24