Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Basics of Interfaces and Generic Types

Learning objectives

  • You can use interfaces to define a contract that specifies the behavior of a class.
  • You can implement the Comparable interface, which enables objects to be ordered and sorted.
  • You understand the concepts of generic classes and type parameters.
  • You can implement reusable classes and methods using generic types.