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
Why generics are used in java?
Why java is considered as platform independent?
What is void keyword?
How to compare two strings in java program?
Define an applet in java?
What is a default constructor and also define copy contrucyor?
How would you convert bytes to string?
Can we declare a constructor as final?
When we should use serialization?
What is the advantage of OOP in java?
Explain when classnotfoundexception will be raised ?
What is the common usage of serialization? What exceptions occur during serialization?
What is the structure of java?
what is ststic with example
How do generics work in java?