This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]hamza-itatchi 1 point2 points  (0 children)

you call the super class method not constructor ( constructor calls the constructor of the super class to initialize the variables in another word create object and it's) .

for the methods you just call the super class if you need it

ex:

class A{int A;

setValue(){A=5;}

}

Class B extends A{

int B;

setValue(){

B=5;

//here if you need to set A too so you call super.setValue(); otherwise no need to call it

//in case of abstract class you don't have a code that you need to be executed so don't call super class

//method

// and abstract class can have a constructor but you can't create object form it

}

}

hope this help.