+ 2

What is the use of this and super keywords in java ?Can anyone explain me with some examples?

17th Dec 2016, 5:57 PM
PRAVALLIKA.K
PRAVALLIKA.K - avatar
2 Antworten
+ 4
"this" refers to the current object that called method a = new obj(); function obj(){ this.x = 5 } a.x gives 5
17th Dec 2016, 6:04 PM
Valen.H. ~
Valen.H. ~ - avatar
0
super keyword is refer to super class. How to use it? - You can use it when you want to call constructor of super class - You can uses it when you want call a method of super class
18th Dec 2016, 2:13 AM
The PGDeveloper
The PGDeveloper - avatar