What is a super keyword in Java

The `super` keyword in Java is a reference variable which is used to refer to the immediate parent class object. It is primarily used to access superclass methods and constructors, as well as to access superclass fields. This keyword helps in controlling the method overriding and constructor chaining.
Java, super keyword, inheritance, superclass, method overriding, constructor chaining
class Parent {
            void display() {
                System.out.println("This is the Parent class.");
            }
        }

        class Child extends Parent {
            void display() {
                super.display(); // Calls Parent's display method
                System.out.println("This is the Child class.");
            }
        }

        public class Main {
            public static void main(String[] args) {
                Child child = new Child();
                child.display(); // Output: This is the Parent class. This is the Child class.
            }
        }
        

Java super keyword inheritance superclass method overriding constructor chaining