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 variable and example?
Explain reverse a linked list iterative solution in java?
Why call by value prevents parameter value change?
What are the basic interfaces of java collections framework?
Does java trim remove newline?
What does nullpointerexception mean?
What is an infinite loop? How infinite loop is declared?
What is tochararray in java?
What is the difference between serial and throughput garbage collector?
Is java a prime method?
Can we have try block without catch block?
Can we define static methods inside interface?
Difference between comparator and comparable in java?
How do we access static members in java?
What are the skills required for core java?