Super() means invoke the constructor of the parent class. That is how instantiation of classes in an inheritance hierarchy works in java: the top level parent has to be created first and then the second most top level all the way until the class level that we are actually instantiating. In java implicitly the default constructor of the parent(i.e. with no arguments) is called as the first instruction in every constructor from a class that inherits another. So there is a hidden super() as the first line in any constructor. Of course you can always call it explicitly and sometimes you have to. For example if the parent has only a constructor with a parameter, then in the subclass constructors you always have to explicitly call that constructor using super(paramValue) since there will be no default constructor in the parent so the implicit super() will fail generating a compile error. Answer from dragosb91 on reddit.com
🌐
W3Schools
w3schools.com › java › java_inheritance.asp
Java Inheritance (Subclass and Superclass)
In Java, it is possible to inherit ... (child) - the class that inherits from another class · superclass (parent) - the class being inherited from...
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › subclasses.html
Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
In the Java language, classes can ... from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass ......
Discussions

What is the purpose of super() in a class constructor method?
Super() means invoke the constructor of the parent class. That is how instantiation of classes in an inheritance hierarchy works in java: the top level parent has to be created first and then the second most top level all the way until the class level that we are actually instantiating. In java implicitly the default constructor of the parent(i.e. with no arguments) is called as the first instruction in every constructor from a class that inherits another. So there is a hidden super() as the first line in any constructor. Of course you can always call it explicitly and sometimes you have to. For example if the parent has only a constructor with a parameter, then in the subclass constructors you always have to explicitly call that constructor using super(paramValue) since there will be no default constructor in the parent so the implicit super() will fail generating a compile error. More on reddit.com
🌐 r/learnjava
17
43
May 20, 2020
Creating a superclass and subclass with constructors - Java - Stack Overflow
Explore Stack Internal ... I am new to Java. I have a problem to solve, but I don't quite understand how constructors work. I understand how to create a superclass and a subclass but I don't understand the constuctors within them (or how they actually work - I have done rediculous amounts of research on constructors, but it's just not making much sense). I am trying to write a program that creates a superclass called Employees. This Employee class ... More on stackoverflow.com
🌐 stackoverflow.com
Question about constructor in superclass and subclass
So the purpose of the constructor is to initialize an object. The most basic way of using it is to initialize any starting data values that an object relies on. If a class does not have a no-argument constructor, it is not possible to instantiate a new object without first inputting some values. Imagine you have a Person class, that has a String name data field. You want your code to operate such that any Person object you create must have a name, therefore you require that the user enters the name when they instantiate a new Person object: public class Person { String name; public Person(String name){ this.name = name; } } If you know the basics, it should be pretty clear that you will not be able to instantiate a new Person object without including a name: Person myPerson = new Person(); // will return an error Person myPerson = new Person("John"); //will create a Person object as desired Now, let's say we want to create another class that extends Person, for example Programmer. Let's try creating this class using a no-arg constructor: public class Programmer extends Person { String language = "Java"; public Programmer(){ //we'll get to this later } public void helloWorld(){ System.out.println("Hello world! My name is " + name + ". I can program in " + language); } } Now what happens if we try to instantiate a Programmer object, and run the helloWorld() function using it? The superclass Person has the name variable, so we should be able to access it in the subclass -- sharing data in this way is one of the major benefits of inheritance, after all. But the object that we've instantiated doesn't have a name associated with it. Hopefully, now it is starting to make sense why this wouldn't work. Instead, when we write the constructor for the Programmer class, we do it in this way: public Programmer(String name){ super(name); //this calls the constructor in Person, allowing us to initialize the name variable! } Does it now make sense why if the superclass lacks a no-argument constructor, you must use the super() call with the correct arguments in your subclass constructor? It's because otherwise, you have no way of initializing the variables in your superclass that you may want to use in your subclass. I hope that this is helpful, let me know if you have further questions. More on reddit.com
🌐 r/learnjava
14
3
August 14, 2024
ELI5: Constructors & Inheritance in Java Classes

OK. The idea behind a constructor is to set up an instance of your class. You can think of the parameters of a constructor as "prerequisites" to make an instance.

If you define no constructors in a class, the compiler will generate a zero-argument constructor that does nothing.

So, let's say your class models a Car. Well, what are some things all Cars have? It probably has a top speed, a fuel efficiency, and a number of people it seats. (Trying to keep things simple for example's sake.) Since you don't ever want to create a car without those values, we want them as constructor parameters rather than relying on the user of your class to call all the right set...() methods. With the constructor, the user of the Car class is forced to provide the required parameters whenever they instantiate Cars. You can have multiple constructors that take different parameters, but you can only pick a constructor from the ones that are defined, so if we define one constructor for a Car, you must use that constructor to create them.

So, the car constructor might look like this:

public class Car { 

private int topSpeed, passengersSeated;
private Integer milesPerGallon;


public Car (int topSpeed, Integer milesPerGal, int passengers) {
this.topSpeed = topSpeed;
this.milesPerGallon = milesPerGal;
this.passengersSeated = passengers;

}

// start the engine...
public void start(int someVal) { ... }

}

Now, let's say we want to build a Fire Truck. A Fire Truck is just a specialized type of car. We want our FireTruck to have an Engine Number and a hose length, right? So, let's define a FireTruck.

public class FireTruck extends Car {

private int engine, hose;

public FireTruck(int engineNum, int hoseLength) {
this.engine = engineNum;
this.hose = hoseLength;
}
}

Looks good, right? No! Why? Because a Fire Truck is a Car, and a Car must have a topSpeed, a milesPerGal and a passenger count. Our FireTruck has to have those values too, or it's not a Car. We could pass those parameters into our FireTruck constructor, but we can't just assign them to our Car member variables in the FireTruck constructor because they're private. The Car constructor sets those values for us, and it might do other logic we need. So, we'll call the Car constructor from inside our FireTruck constructor, so we can build the part of the FireTruck that is a Car before we add the FireTruck stuff. We use the "super" keyword to reference the base class's constructors and methods.

 public class FireTruck extends Car {

private int engineNum, hoseLength;

public FireTruck(int topSpeed, Integer mpg, int passengers, int engine, int hose) {

// Call the base class's constructor.
// Must be the first line in this constructor.
super(topSpeed, mpg, passengers);

// Now we've set up the base Car "inside" our FireTruck.
// Add the rest of our details.
engineNum = engine;
hoseLength = hose;

}

// you can also use "super" to call functions that are in the base class --
// do this when you override a function to add more functionality.

@Override
public void start(int someVal) {

// Radio dispatch and tell them you're leaving!
// Cars don't have to do this but we do
sendDispatch("Engine " + engineNum + " is heading to the fire!");

// Call the start() method of the base class to turn on the engine, like Cars do.
// Unlike super() constructors, super. member methods can be called anywhere in any member method.
// If the super. keyword were omitted, this would become an infinite recursive loop
// because this same method would get called.
super.start(someVal);

// After starting the truck, there could be more steps to do...
startSiren();
addPassenger(dalmatian);

}
}

You can also use subclass constructors to hard-code values. For example, a Tesla Model S is a Car with no miles per gallon, since it's electric. So...

 public class Tesla extends Car { 

private int volts;

public Tesla (int topSpeed, int passengers, int batteryVolts) {

// no MPG since it's electric
super(topSpeed, null, passengers);

this.volts = batteryVolts;
}
}

You can even call a constructor in the same class, by using the "this" keyword.

public class Car { 

private int topSpeed, passengers;
private Integer mpg;

// radio comes standard, so it's 'true' by default; we don't need to set it in every constructor.
private boolean radio = true;

public Car (int topSpeed, Integer mpg, int passengers) {
this.topSpeed = topSpeed;
this.mpg = mpg;
this.passengers = passengers;


// Lots of complicated German engineering goes here...

}

// Some cars might not have a radio; set that in this alternate constructor.
public Car (int topSpeed, Integer mpg, int passengers, boolean satelliteRadio) {

// Don't rewrite all the hard stuff from the other constructor, just call it!
// Like super() constructors, must be the first line in this constructor if you want to use it.
this(topSpeed, mpg, passengers);

// Special stuff in this constructor
this.radio = satelliteRadio;
}

}
More on reddit.com
🌐 r/javahelp
5
7
September 28, 2011
🌐
GeeksforGeeks
geeksforgeeks.org › java › super-keyword
Super Keyword in Java - GeeksforGeeks
The super keyword in Java is a reference variable that is used to refer to the parent class when we are working with objects.
Published   July 23, 2025
🌐
GeeksforGeeks
geeksforgeeks.org › java › access-super-class-methods-and-instance-variables-without-super-keyword-in-java
Access Super Class Methods and Instance Variables Without super Keyword in Java - GeeksforGeeks
July 23, 2025 - Class Name: The name of the class that must follow the rules as follows while creating the variables in java. Super class : The parent class from which many subclasses can be created.
🌐
Reddit
reddit.com › r/learnjava › what is the purpose of super() in a class constructor method?
r/learnjava on Reddit: What is the purpose of super() in a class constructor method?
May 20, 2020 -

Would it be accurate to say that the word super makes the class inherit all the methods of its parent class which is Object? Is the line super(); responsible for Java knowing that every instance of my class is also an Object? Does the super(); line do anything else in this case?

Just in case this needs clarification, this is what i'm talking about

public class Product {
       int id;
       String name;

public Product(int id, String name) {
	super();
	this.id = id;
	this.name = name;
   }
Top answer
1 of 4
2

I guess you want something like this. Be noted, that it is a good idea to separate classes one-per-file in this case, as they are separate entities here. It is a good idea to limit data access to entity fields, as such using encapsulation.

Employee.java:

package tryingoutjava;

public class Employee {

    // Protected access because we want it in Manager
    protected int employeeId;
    protected String employeeName;

    public Employee(int employeeId, String employeeName) {
        this.employeeId = employeeId;
        this.employeeName = employeeName;
    }
}

Manager.java:

package tryingoutjava;

public class Manager extends Employee {

    private String employeeTitle;

    public Manager(String employeeTitle, int employeeId, String employeeName) {
        // Use super to invoke Employee constructor
        super(employeeId, employeeName);
        this.employeeTitle = employeeTitle;
    }

    // Just create a simple string describing manager
    @Override
    public String toString() {
        return "Manager{" +
                "employeeTitle='" + employeeTitle +
                "employeeId=" + employeeId +
                ", employeeName='" + employeeName + '\'' +
                '}';
    }
}

Application.java:

package tryingoutjava;

public class Application {

    // Example of construction plus printing of Manager data
    public static void main(String[] args) {
        Employee davie = new Employee(1, "Dave The Cable Guy");
        Manager tom = new Manager("CFO", 2, "Tomas");
        System.out.println(tom.toString());
    }
}

Constructors (most often than not) just delegate construction of parent through super invocation. While there are other techniques, like Builder pattern, this is the most basic and understandable approach. There are several other ways to do this, but this should get you started, hope it helps!

2 of 4
1

Purpose of Constructor

constructor is a method like other method but it is called when instantiate (or create a object from your class) for initialize your object for first use or later use. for example a class like Student must created (instantiated) when we give it name and family name for example. Without them, create a Student is not good because maybe we forget to give it proper name and use it incorrectly. constructor forces us to provide minimum things needed for instantiating objects from classes.

Constructor implementation in inheritance

About inheritance, it is different. When you want to create a Student which is a Human (extends Human) you must first create Human inside your Student and set special feature for your Student like ID which is not for Human (Human has name and etc). so when you create a Student with constructor, the super constructor (for Human) is called too.

What do we do in constructor

as I mentioned, we provide default value for our properties which must set them before creating and using object. (for using them properly) every subclass call super class constructor implicitly with super() but if super class doesn't have any default constructor (constructor with no argument) you must explicitly say super(...) at the first lien of subclass constructor (otherwise compile error)

What is the program steps when using constructor (Advanced)

  1. super class static constructor and static variable (read by self if you want to know more about things I say here)
  2. subclass class static constructor and static variable
  3. super class variable and block constructor
  4. super class constructors
  5. sub class variable and block constructor
  6. sub class constructors

I only mentioned 4 & 6. I try to explain completely. My English is not good. I'm sorry.

🌐
Quora
quora.com › Why-is-the-super-keyword-a-must-to-run-a-child-class-in-Java
Why is the super keyword a must to run a child class in Java? - Quora
Answer (1 of 5): A method in a child class redefines (‘@’overrides) a method in the parent class if it is the same name with the same parameter. It was realised in Simula that a routine in a child class extends the functionality of the routine in the parent class, so that should also be run.
Find elsewhere
🌐
CodeSignal
codesignal.com › learn › courses › java-classes-basics-revision › lessons › java-inheritance-and-the-super-keyword
Java Inheritance and the super Keyword
This initialization allows the Car class to inherit the brand attribute from the Vehicle class seamlessly. Understanding the super Keyword in Method Overriding · The super keyword is essential in inheritance for calling superclass methods from a subclass, especially useful in method overriding. It enables a subclass to extend or utilize the functionality of a superclass without directly modifying it. Method overriding in Java allows a subclass to provide a specific implementation of a method already defined in its superclass.
🌐
Programiz
programiz.com › java-programming › super-keyword
Java super Keyword (With Examples)
As we know, when an object of a class is created, its default constructor is automatically called. To explicitly call the superclass constructor from the subclass constructor, we use super(). It's a special form of the super keyword. super() can be used only inside the subclass constructor ...
🌐
DataCamp
datacamp.com › doc › java › super
super Keyword in Java: Usage & Examples
The super keyword in Java is used to refer to the immediate parent class object.
🌐
Career Karma
careerkarma.com › blog › java › java super
Java Super: define a new class from an existing class
December 1, 2023 - In Java, the superclass, also known as the parent class, is the class from which a child class (or a subclass) inherits its constructors, methods, and attributes.
🌐
TutorialsPoint
tutorialspoint.com › what-is-the-super-class-of-every-class-in-java
What is the super class of every class in Java?
February 28, 2025 - The Object class is the superclass of every single class in Java. This position implies that every class in Java, even if a built-in class or function like String or a user-defined one, directly or indirectly inherits from Object. Understanding the
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › super.html
Using the Keyword super (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
See Java Language Changes for a ... in Java SE 9 and subsequent releases. See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases. If your method overrides one of its superclass's methods, you can invoke the overridden method through the use of the keyword super. You can also use super to refer to a hidden field (although hiding fields is discouraged). Consider this class, ...
🌐
Quora
quora.com › What-is-a-super-class-variable-in-Java
What is a super class variable in Java? - Quora
Answer (1 of 2): In Java, a super class variable refers to a variable that is defined in the parent class of a class hierarchy. A class hierarchy is a relationship between classes, where one class is the parent class (or super class) and the ...
🌐
Simplilearn
simplilearn.com › home › resources › software development › super keyword in java: an ultimate guide
Super Keyword in Java: An Ultimate Guide
July 31, 2025 - Master Java inheritance with 'super' keyword! Unleash its power to refine object-oriented code & build robust applications. Read to know more!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Whitman College
whitman.edu › mathematics › java_tutorial › java › javaOO › subclasses.html
Subclasses, Superclasses, and Inheritance
In Java, as in other object-oriented programming languages, classes can be derived from other classes. The derived class (the class that is derived from another class) is called a subclass. The class from which its derived is called the superclass.
🌐
W3Schools
w3schools.com › java › ref_keyword_super.asp
Java super Keyword
assert abstract boolean break byte case catch char class continue default do double else enum exports extends final finally float for if implements import instanceof int interface long module native new package private protected public return requires short static super switch synchronized this throw throws transient try var void volatile while Java String Methods
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › objectclass.html
Object as a Superclass (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
See The try-with-resources Statement and Finalization and Weak, Soft, and Phantom References in Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide. You cannot override getClass. The getClass() method returns a Class object, which has methods you can use to get information about the class, such as its name (getSimpleName()), its superclass (getSuperclass()), and the interfaces it implements (getInterfaces()).
🌐
Scientech Easy
scientecheasy.com › home › blog › superclass and subclass in java
Superclass and Subclass in Java - Scientech Easy
April 18, 2025 - A class that is used to create a new class is called superclass in Java. In the words, the class from where a subclass inherits the features is called superclass.