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 the original name of java?

545


Can a class be defined inside an interface?

565


What is an abstract method in java programming?

609


Why do we need hashset in java?

506


What is java in detail?

562






What are the basic control structures?

501


What is externalizable interface?

584


What do you understand by java virtual machine?

711


What is the program compilation process?

588


State some situations where exceptions may arise in java?

629


What is the private method modifier?

589


How do you use nextline in java?

509


How to make object serializable in java?

555


What is connection class in java?

514


What is meant by inheritance and what are its advantages?

583