Getting Started with Java
This is a 100% free course, but we need you to first join or login to watch this video.Alright, join or login here.
This video shows an example of inheritance in Java. Create a Shape superclass and extend a Rectangle from it. Create a Square that extends from the Rectangle. Add a display() method and a getArea() method to the Shape class. We can access these methods from the object of a Square or Rectangle as these methods are inherited.