Questionaries.org
Login
Register
Questions
Unanswered
Tags
Users
Ask a Question
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)
subclass
superclass
constructor
method
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
The superclass constructor runs before the subclass constructor ...
asked
1 year
ago
by
eagles11
(
179,830
points)
method
constructor
superclass
3
like
0
dislike
0
answers
What is the difference between a constructor and a method?
asked
1 year
ago
by
DBA-boss
(
120,990
points)
constructor
method
java
6
like
0
dislike
1
answer
What is the difference between a break statement and a continue statement?
asked
1 year
ago
by
DBA-boss
(
120,990
points)
java
method
constructor
difference
5
like
0
dislike
1
answer
What is the difference between a while statement and a do statement?
asked
1 year
ago
by
sr_webmaster
(
21,000
points)
java
method
constructor
5
like
0
dislike
1
answer
What property must you set, and what method must you call in your code?
asked
1 year
ago
by
daneim
(
127,080
points)
property
method
code
repeater
control