eferr to:lautturi.com/**
* @author lautturi.com
* Java example: Java super Keyword Example
*/
import java.util.*;
class Animal { // Superclass (parent)
public void display() {
System.out.println("an animal");
}
}
class Dog extends Animal { // Subclass (child)
public void display() {
super.display();
// Call the superclass method
System.out.println("a dog");
}
}
public class Main {
public static void main(String args[]) {
// Create a Dog object
Animal myDog = new Dog();
// Call the method on the Dog object
myDog.display();
}
}