Reusing code across classes (creating PARENT-CHILD relationship)
extends
Used in class declarations to create a subclass that inherits fields and methods from a superclass
@Override
Subclasses can override methods of the superclass to provide specific implementations
super()
Calling the superclass constructor in subclass constructor
super
Refer to parent class object in subclass
publicclassMain{publicstaticvoidmain(String[]args){DogmyDog=newDog();/*
Animal is created.
Dog is created.
*/myDog.eat();/*
This animal eats food.
The dog eats dog food.
*/myDog.bark();/*
The dog barks.
*/myDog.move();/*
This animal is moving.
*/}}classAnimal{publicAnimal(){System.out.println("Animal is created.");}publicvoideat(){System.out.println("This animal eats food.");}publicvoidmove(){System.out.println("This animal is moving.");}}classDogextendsAnimal{publicDog(){super();System.out.println("Dog is created.");}@Overridepublicvoideat(){super.eat();System.out.println("The dog eats dog food.");}publicvoidbark(){System.out.println("The dog barks.");}}