In Java inheritance, super and this serve different roles:

  1. super:
    • Refers to the parent class.

    • Used to call the parent class’s constructor, methods, or variables.

    • Example: super() calls the parent class constructor.

  2. this:
    • Refers to the current object (the instance of the class).

    • Used to call current class methods, constructors, or to access class members.

    • Example: this() calls the current class’s constructor.

In short:

super accesses the parent class.

this accesses the current class.