Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

Can a class inherit the constructors of its superclass?

Answer Posted / gayathri

import java.io.*;

class Parent
{
Parent()
{
System.out.println("This is super class Constructor");
}
}
class Code3 extends Parent
{
Code3()
{
System.out.println("This is child class");
}
public static void main(String ar[])
{
Code3 c=new Code3();
}
}

Here if i call the child class constructor,even the parent class constructor is implicitly invoked,that means constructors can be inherited.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we execute a program without main?

194


What is keyset in java?

182


Can an object subclass another object?

182


Explain wait(), notify() and notifyall() methods of object class ?

227


Explain the importance of throws keyword in java?

211






How can we find the sum of two linked lists using stack in java?

199


How to make a class or a bean serializable?

222


What is the original name of java?

172


What an i/o filter?

207


What are the four pillars of java?

187


Explain static nested classes ?

212


How to implement a multithreaded applet?

1803


What is not object oriented programming?

152


Which programming language is best in future?

176


What is data type example?

181