# extends Java Keyword

The extends keyword is used in a class or interface declaration to indicate that the class or interface being declared is a subclass of the class or interface whose name follows the extends keyword.

## Examples

      public class Rectangle extends Polygon
      {
      }

## Remarks

- In the example above, the Rectangle class inherits all of the public and protected variables and methods of the Polygon class.

- The Rectangle class may override any non-final method of the Polygon class.

- A class may only extend one other class.

Related Topics

class Java Keyword

implements Java Keyword

interface Java Keyword