Answer Posted / kabita
'this' and super are two keywords in java.
'this' doesn't support inheritance bt 'super' supports
inheritance.
this keyword is used in two cases
1.to differentiate betn instance and local variables.
2.calling of one constructor from another constructor.
Restriction:this keyword should be written in lowercase &
must used in firstline.more than one 'this' keyword is not
used in one block.
super is used 4 three reason.
1.differentiates betn superclass variable & child class
variables.
2.calling of superclass constructor in childclass
constructor.
3.it is also used in calling of superclass override method
in child class.
restriction:
it must be in 1stline.
must be in lowercase.
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is use of valueof () in java?
Difference between serialization and deserialization in java?
Is a method a function?
Can constructor be static or final?
What is the use of singleton class?
What are different access specifiers in java? Explain
What's the default access specifier for variables and methods of a class?
What will happen if a thrown exception is not handled?
Which number is denoted by leading 0x or 0x in java?
In java, what is the difference between method overloading and method overriding?
Is ruby built on java?
What is time complexity java?
Why isn’t there operator overloading?
What is main string [] args?
What is abstraction in java?