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
Can we inherit inner class?
What are abstract classes and anonymous classes?
What is outofmemoryerror in java?
What is the meaning of nullable?
What are predicates in java 8?
How long will it take to learn java?
How many types of variables are there?
What happens when main () method is declared as private?
What is the difference between overriding and overloading in OOPS.
What is a platform?
How does a for loop work?
How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?
Why are arrays useful in java?
How do you execute a thread in java?
What are keywords in programming?