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

Write a program to print 15 random numbers using foreach of java 8?

533


What is the use of runnable interface?

593


What are runtime exceptions?

597


Can a set contain duplicates?

509


What is an infinite loop? How infinite loop is declared?

556






What is the largest number a double can hold?

553


What is jpa specification?

529


How many types of gc are there in java?

547


Can we override constructor in java?

563


Why are global variables used?

490


What is the byte range?

571


What is token in java?

522


How many types of keywords are there?

546


When is the finalize() called? What is the purpose of finalization?

569


how would you implement a thread pool? : Java thread

497