Difference between this(), super()?

Answer Posted / nikhlesh gupta

this() call one of user define constructor inside another user constructor of the same class such as this(a), this(a,b) & so on.
super() call one of base class constructor inside the derive class constructor such as super(a), super(a,b) & so on.

Is This Answer Correct ?    26 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the restrictions that are applied to the java static methods?

534


What is scope & storage allocation of global and extern variables? Explain with an example

585


How do you add an element to a hashset in java?

494


What if constructor is protected in java?

563


Why string is not a wrapper class?

646






What is an exception in java?

648


Why hashmap is used in java?

553


If an object reference is set to null, will the garbage collector immediately free the memory held by that object?

639


What is multi level inheritance in java?

563


What are java packages?

587


Can inner class extend any class?

600


Is there a case when finally will not execute?

569


What is the difference between static (class) method and instance method?

580


Can we override constructors in java?

682


Can we override compareto method?

510