Can a class inherit the constructors of its superclass?
Answer Posted / qim2010
No. A class cannot inherit constructor of its superclass but
can call the superclass constructor. If a class called
“SpecialPet” extends your “Pet” class then you can use the
keyword “super” to invoke the superclass’s constructor. E.g.
public SpecialPet(int id) {
super(id); //must be the very first statement in the
constructor.
}
To call a regular method in the super class use:
“super.myMethod( );”. This can be called at any line
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Which is easier netbeans or eclipse?
What is lossy conversion in java?
Can we clone singleton object?
What is the instance of an object?
What is reflexive association?
when you will synchronize a piece of your code? : Java thread
What is the difference between dom and sax parser in java?
What is bifunction in java?
Is null a keyword in java?
os is developed in c no java is more secured then c na why dont the os developed is developed using java
What are void methods?
what is server side caching?
How we can skip finally block of exception even if some exception occurs in the exception block in java?
What is a singleton puppy?
Why singleton is not thread safe?