in a constructor what happen if u call super and this in
the same class? i know that it is not possible to call
both in the same one? if we call what will happen?

Answer Posted / atul

class A
{
public A()
{ super();//this is perfect no error
super();//but this call generate RunTimeException
//because inside constructor super called
//must be in first called ok thats it
}
public static void main(String args[])
{
A a1=new A();

}
}

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 api in java?

632


Why java is said to be pass-by-value ?

655


What are the basic interfaces of java collections framework?

704


Is string is a class in java?

609


Can we have return statement in finally clause? What will happen?

609






What is data type in java?

575


In how many ways we can do exception handling in java?

672


How many classes can any class inherit java?

590


How will you call an Applet using Java Script Function?

635


What is arguments in java?

603


What is an array length?

588


What are access specifiers in java ?

683


When do we use hashset over treeset?

619


What is meant by 'bit masking' in java?

747


How many bits is a char?

623