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 is the main function in java?
What are the different types of sorting in java?
What is the major advantage of external iteration over internal iteration?
What is the difference between a field variable and a local variable?
What is a method vs function?
What is reflexive association?
What is an object in java?
What is the static field modifier?
What is thread safe java?
Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?
What is the use of isempty in java?
Define jit compiler?
Why deletion in linkedlist is fast than arraylist?
What is java instanceof operator?
What is the difference between multitasking and multithreading in Java