Difference between this(), super()?
Answers were Sorted based on User's Feedback
Answer / venki
this can be pointing to current object.
super can be used for accesing super class metods &varibles.
'this &super' are use full for constructers also .
thes two statements defining first satatement of
constructer.'this' is used for accesing current class
constuter.where as super is accessing super class
|Is This Answer Correct ?||55 Yes||5 No|
Answer / janet
this() can be used to invoke a constructor of the same
class where as super() can be used to invoke a super class
|Is This Answer Correct ?||53 Yes||6 No|
Answer / 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|
this() call one of user define constructor inside another user constructor of the same class such as this(a), this(a,b) & so on.
super() call one of base class constructor inside the derive class constructor such as super(a), super(a,b) & so on.
|Is This Answer Correct ?||26 Yes||5 No|
Answer / a .k. singh
This keyword is pointing the same class object.and
super keyword is accessing the superc lass constructor
|Is This Answer Correct ?||10 Yes||2 No|
Answer / a.k.singh
your ans no.6 is wrong because (superc lass )constructor
superc lass mence!!!!!!!!!!1
|Is This Answer Correct ?||11 Yes||3 No|
Answer / ghulam mujtaba
this()can be used invoke to Constructor of the same class
Whereas super() can be used to invoke a super class
|Is This Answer Correct ?||10 Yes||4 No|
Answer / shanthappa
"this" is the implicit keyword/object oriented by the jvm and supplied to every java programs for two purposes.
1) It points to current class object
2) It whenever formal parameters of the class are similar then jvm gets an ambiguity.
"super" is a keyword which will differentiate base class features with derived class features.
The keyword 'super' is placing an important role in three places in java...
1)at variable level
2)at constructor level
3)at method level
|Is This Answer Correct ?||3 Yes||0 No|
What is emant by API? is it related to java only or it is common for all OOPS supporting language?
Why Java is called as purely platform independent..? Explain briefly..dont Give regular answers Explain with your own example..?
Tell me the difference between an applet and a Japplet?
why there are multiple catches for a try block.don't tell me that there can be multiple exception of a code segment that's why.tell me the real fact behind this.
What are the common problems you have faced while implementing Java?
What is the difference between a Window and a Frame?
What is a layout manager?
Can I create any Marker Interface? If yes then how can I use it???
What is an exception?
how we can use debug in myeclipse 6.0 in order solve the problems that exist in our program when there are 900 to 1000 pages in a web application
Explain method overloading and overriding?
What is the difference between interpreter and compiling ?