Meaning of Super Keyword [closed] Meaning of Super Keyword [closed] android android

Meaning of Super Keyword [closed]


super is a keyword in Java. It refers to the immediate parents property.

super()            //refers parent's constructorsuper.getMusic();  //refers to the parent's method

-Read More on super


The super keyword refers to the instance of the parent class (Object, implicitly) of the current object. This is useful when you override a method in a subclass but still wants to call the method defined in the parent class. For example:

class ClassOne {      public say() {       System.out.println("Here goes:");  }}class ClassTwo extends ClassOne {           public say() {            super.say();            System.out.println("Hello");    }  }

Now, new ClassTwo().say() will output:

Here goes:Hello

As others have mentioned, super() will call the parent's constructor, and it can only be called from the subclass' constructor (someone correct me if I'm wrong).


The super keyword is not specific to Android. It's a concept belonging to OOP, and represents the parent class of the class in which you use it. In Android, it's mostly usefull when you create your own Activity or component, and lets you call a default behavior before implementing yours.

For instance, the super methods must be called before anything when you override the Activity onPause, on Resume, onStop etc... methods.

For more information, I suggest you take a look at Object Oriented Programming books, as well as Java Programmation books, which should cover the subject more deeply.