Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

How can a subclass call a method or a constructor defined in a superclass?

5 like 0 dislike
Hello guys,

How can a subclass call a method or a constructor defined in a superclass?

please tell me about superclass
asked 1 year ago by daneim (127,080 points)

1 Answer

1 like 0 dislike
 
Best answer
Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass’s constructor.
answered 1 year ago by marck_don (191,010 points)

Related questions

7 like 0 dislike
1 answer
3 like 0 dislike
0 answers
5 like 0 dislike
1 answer