Difference between this(), super()?

Answer Posted / priyanka das

"super" is a keyword used to invoke superclass data members and also superclass member methods,whereas "this" is a keyword used to invoke the current class data member as well as current class member methods.

A super object can be used to retrieve super class members."this' object can be used to invoke only the current class members.


Again super() can be used to invoke the superclass constructor where as this() can be used to invoke current class constructor.

Is This Answer Correct ?    23 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does treeset use compareto?

536


Can we define static methods inside interface?

517


How do you escape json?

536


What are the 4 versions of java?

553


How many bits is a float?

533






What is method in java ?

620


Define the term string pool?

582


What is flag in java?

529


What are different types of control structures?

487


Can static method access instance variables ?

590


What is the r character?

582


What is a conditional statement explain with example?

536


How many bytes is a char in java?

522


What if constructor is protected in java?

556


What is the difference between a static and a non-static inner class in java programming?

522