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!

Answer from TSB99X on Stack Overflow
🌐
W3Schools
w3schools.com › java › java_inheritance.asp
Java Inheritance (Subclass and Superclass)
Java Examples Java Compiler Java Exercises Java Quiz Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... In Java, it is possible to inherit attributes and methods from one class to another. We group the "inheritance concept" into two categories: subclass (child) - the class that inherits from another class · superclass (parent) - the class being inherited from
🌐
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, ...
🌐
DataCamp
datacamp.com › doc › java › super
super Keyword in Java: Usage & Examples
This is useful for extending or modifying the behavior of the inherited method. class Parent { void display() { System.out.println("Parent display"); } } class Child extends Parent { void display() { super.display(); // Calls Parent's display method System.out.println("Child display"); } }
🌐
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 › subclasses.html
Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
In the Java language, classes can be derived from other classes, thereby inheriting fields and methods from those classes. Definitions: A class that is derived 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 ...
🌐
GeeksforGeeks
geeksforgeeks.org › java › super-keyword
Super Keyword in Java - GeeksforGeeks
Call to super() must be the first statement in the Derived(Student) Class constructor because if you think about it, it makes sense that the superclass has no knowledge of any subclass, so any initialization it needs to perform is separate from and possibly prerequisite to any initialization performed by the subclass. Therefore, it needs to complete its execution first. If a constructor does not explicitly invoke a superclass constructor, the Java compiler automatically inserts a call to the no-argument constructor of the superclass.
Published   July 23, 2025
🌐
Scientech Easy
scientecheasy.com › home › blog › superclass and subclass in java
Superclass and Subclass in Java - Scientech Easy
April 18, 2025 - In this tutorial, we will understand the concepts of superclass and subclass in Java with the help of various examples. Inheritance is one of the most powerful features of object-oriented programming (OOP) in Java. It is a technique which allows us to create a new class by extending a previously ...
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.

Find elsewhere
🌐
Runestone Academy
runestone.academy › ns › books › published › csjava › Unit10-Inheritance › topic-10-7-Object.html
10.7. Object Superclass — CS Java
The provided method will be called instead of the inherited one, which is why we say that the new method overrides the inherited method. The Person class below overrides the inherited equals method. ... Try to guess what this code will print out before running it. Figure 2: A picture from the Java Visualizer showing the object references and objects.¶
🌐
TutorialsPoint
tutorialspoint.com › what-is-the-super-class-of-every-class-in-java
What is the super class of every class in Java?
Every class inherits from an Object. Java ensures that all objects share a common set of functionalities, which promotes consistency and simplifies the language's design. Let's test it with an example. The java.lang.Class.getSuperclass() returns the Class representing the superclass of the entity (class, interface, primitive type, or void) represented by this Class.
🌐
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.
🌐
Career Karma
careerkarma.com › blog › java › java super
Java Super: define a new class from an existing class
December 1, 2023 - This constructor, when invoked, uses super() to invoke the BankAccount constructor in the BankAccount class. This prints Parent account type: Bank Account to the console. Then, the SavingsAccount constructor prints Main account type: Savings ...
🌐
Programiz
programiz.com › java-programming › super-keyword
Java super Keyword (With Examples)
Note that in the above example, we explicitly called the parameterized constructor super("Animal"). The compiler does not call the default constructor of the superclass in this case. Use of super Keyword · Access overridden methods of the superclass · Access attributes of the superclass · Access superclass constructor Using super() Previous Tutorial: Java Method Overriding · Next Tutorial: Java Abstract Class and Abstract Methods ·
🌐
CodeSignal
codesignal.com › learn › courses › java-classes-basics-revision › lessons › java-inheritance-and-the-super-keyword
Java Inheritance and the super Keyword
Similar to attributes, method inheritance allows a subclass to inherit the methods of its superclass. In the example below, the Car class can invoke the start method from the Vehicle class: In the absence of a specific constructor in the Car class, Java provides a default constructor that internally calls super() to ensure the superclass's constructor is invoked.
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › objectclass.html
Object as a Superclass (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
To test whether two objects are equal in the sense of equivalency (containing the same information), you must override the equals() method. Here is an example of a Book class that overrides equals():
🌐
TutorialsPoint
tutorialspoint.com › subclasses-superclasses-and-inheritance
Subclasses, Superclasses, and Inheritance
A superclass is the class from which many subclasses can be created. The subclasses inherit the characteristics of a superclass. The superclass is also known as the parent class or base class. In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and Motorcycle.
🌐
Tutorialspoint
tutorialspoint.com › java › java_inheritance.htm
Java - Inheritance
In this example, you can observe two classes namely Calculation and My_Calculation. Using extends keyword, the My_Calculation inherits the methods addition() and Subtraction() of Calculation class. Copy and paste the following program in a file with name My_Calculation.java
🌐
Whitman College
whitman.edu › mathematics › java_tutorial › java › javaOO › subclass.html
Creating Subclasses
Java does not support multiple inheritance. Creating a subclass can be as simple as including the extends clause in your class declaration (such as in the declaration in ImaginaryNumber above). However, you usually have to make other provisions in your code when subclassing a class, such as overriding methods. Rule:A subclass inherits all of the member variables within its superclass that are accessible to that subclass (unless the member variable is hidden by the subclass).
🌐
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;
   }
🌐
BeginnersBook
beginnersbook.com › 2014 › 07 › super-keyword-in-java-with-example
Super keyword in java with example
Lets take an example to understand this: In the following program, we have a data member num declared in the child class, the member with the same name is already present in the parent class. There is no way you can access the num variable of parent class without using super keyword.