1. Home
  2. Computing & Technology
  3. Java

Super

By , About.com Guide

Definition:

The super keyword enables a subclass to call the methods and fields of its superclass. It is not an instance of the superclass object but a way to tell the compiler which methods or fields to reference. The effect is the same as if the subclass is calling one of its own methods.

Examples:

Consider a subclass Employee that extends its superclass Person:

public class Employee extends Person{

  public Employee()
  {
    //reference the superclass constructor
    super();
  }

  public String getName()
  {
    //reference superclass behaviors
    return super.getFirstName() + " " + super.getLastName();
  }
}

The super keyword can be used to reference the constructer of the Person class or any of the behaviors or fields that it has access to (e.g., getFirstName() and getLastName()).

Glossary:

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Explore Java
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Java Glossary
  5. S
  6. Definition for the Term: Super>

©2009 About.com, a part of The New York Times Company.

All rights reserved.