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 arrays sort in java?

776


What is an class?

785


Does windows 10 need java?

815


What is meant by class loader? How many types are there?

928


What is the difference between inner class and nested class?

791


What is the use of math abs in java?

769


Define jit compiler?

859


What is nested top-level class?

809


What is immutable in java?

806


How objects of a class are created if no constructor is defined in the class?

832


Can we call virtual funciton in a constructor ?

1978


What is the default value of the local variables?

735


Why do we need wrapper class?

767


Is alive method in java?

739


How can you avoid serialization in child class if the base class is implementing the serializable interface?

873