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
What are "class access modifiers" in Java?
Explain the importance of finally block in java?
What does n mean?
What is the difference between a choice and a list?
Define jit compiler?
Name container classes in java programming?
What is a condition in programming?
What do heavy weight components mean in java programming?
Can an unreferenced object be referenced again?
What is identifier in java?
What is the use of toarray () in java?
What is parsing and its types?
Why local variables are stored in stack?
How does java enable high performance?
what r advatages of websphere? & how to deploy?