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 string english?
What is a war file?
What will happen when using pass by reference in java?
What is the meaning of immutable regarding string?
Explain the selection sort algorithm and state its time complexity?
Can you explain inner class.
What is vector capacity in java?
Can java program run without jre?
Which sorting is used in arrays sort in java?
What is the difference between ArrayList and Vector? which one is better in Java
What happens to the Exception object after handling an exception?
Which data type is a class in java?
Which methods cannot be overridden in java?
What does singleton class mean?
What is unmodifiable collection in java?