TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Java Tutorials

Java super Keyword with Example

Overview

In this tutorial, we will learn about the super keyword in Java. In the previous post, we learned about this keyword.

https://www.testingdocs.com/java-this-keyword-with-example/

super is a reference variable that points to the superclass object. We can use this keyword in a subclass to refer to the parent methods, variables, and constructors.

Example

package staff;

// Constructor
public class SalaryEmployee extends Staff {
 private double empSalary;

 //Constructor
 public SalaryEmployee(String name, String address,double salary) {
 super(name, address);
 this.empSalary = salary;
 }

}

Notice how we have invoked the Parent class constructor using the super keyword.

super(name, address);

—

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Related Posts

Download Greenfoot Windows

Java Tutorials /

Download & Install Greenfoot on Windows

Java Tutorials /

Java Static Code Analysis

Java Tutorials /

Java Testing Tools

Java Tutorials /

Handle Multiple Exceptions in Java

Exceptions_In_Java

Java Tutorials /

Exceptions in Java Programs

‹ Java this Keyword with Example› Creating First Java Application

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com