Can we inherit the constructor in a Class?please give one
example.

Answer Posted / amit

class demo
{
demo()
{
System.out.println("i am default constructor ");
}
}
class demo1 extends demo
{
demo1()
{
System.out.println("i am default constructor ");
}
}
class test
{
public static void main(String st[])
{
demo1 ob=new demo1();
}
}




but it is inherited constructor ....so be can say inherited constructor or/not ?????????

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is natural ordering in java?

735


What's the base class in java from which all classes are derived?

1013


How to check if linked list contains loop in java?

657


What exceptions occur during serialization?

853


Can a class with private constructor be extended?

708


What is concurrent hashmap and its features?

767


Differences between external iteration and internal iteration?

865


What is final, finally, finalize?

803


Is a boolean 1 bit?

839


What is an immutable class? How to create an immutable class?

796


What is a "pure virtual" member function?

858


How do singleton patterns work?

740


What is difference between final and immutable?

789


How will you load a specific locale?

744


Are arrays dynamic in java?

781