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 variable and example?

521


Explain reverse a linked list iterative solution in java?

500


Why call by value prevents parameter value change?

585


What are the basic interfaces of java collections framework?

608


Does java trim remove newline?

541






What does nullpointerexception mean?

617


What is an infinite loop? How infinite loop is declared?

572


What is tochararray in java?

502


What is the difference between serial and throughput garbage collector?

585


Is java a prime method?

553


Can we have try block without catch block?

586


Can we define static methods inside interface?

527


Difference between comparator and comparable in java?

619


How do we access static members in java?

630


What are the skills required for core java?

543