What is the difference between this() and super()?

Answer Posted / puneet khanna

this is used to either call another constructor of the same
class whose object is used to call a method; or whose
constructor is being used to instantiate a class.
This refers to the current object whose reference variable
is used to call method or this refers to the current object
in action,
Super refers to the immediate super class, super(); is
itself placed in the constructor of the class whose super
class doesnt has a constructor declared;for consructor
chaining mechanism.

Is This Answer Correct ?    4 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the class in java?

650


What are strings in physics?

630


Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?

729


How can you handle java exceptions?

614


What is executor memory?

623






Why is stringbuffer not immutable?

662


What is identifier give example?

665


Does java runtime require a license?

660


Define inheritance with reference to java.

669


Write a java program to print fibonacci series?

642


Is array synchronized in java?

651


Can we override the static method?

661


What is contract between hashcode and equal method?

670


What is callablestatement? How you can call stored procedure to pass in parameter?

631


What is casting in java programming?

672