Anyone can explain why. ' this '. keyword is used in java briefly.What errors may occur if we don't use this where it is requir | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Anyone can explain why. ' this '. keyword is used in java briefly.What errors may occur if we don't use this where it is requir

please answer me..

12th Dec 2016, 6:05 AM
MD NOORULLAH RAZA
MD NOORULLAH RAZA - avatar
6 Answers
+ 3
this is required when -function returns object -we process two or more objects -when parameter name is same as data members name
12th Dec 2016, 6:29 AM
manish rawat
manish rawat - avatar
+ 2
it depends on you what you wants to do...like class A { int a; void show(int a) { this.a=a; } } here,method variable name and class variable name is same. so if i give 5. local variable a=5 will be,now if you want to save the value in class variable then you have to write this.a=a; S0..here variable name is same that is why i used this. if the variable name is different then you don't have to use. Now you may ask..why same name?? because if you use different name for different purpose.. there will be many variable name which developer don't want.... there are other use of THIS also
12th Dec 2016, 6:17 AM
Somnath Ghosh
Somnath Ghosh - avatar
+ 1
it not give any error
12th Dec 2016, 6:12 AM
Barath Kumar
Barath Kumar - avatar
+ 1
thank sir
15th Dec 2016, 5:32 AM
MD NOORULLAH RAZA
MD NOORULLAH RAZA - avatar
+ 1
what is the use of listener in event handling?
15th Dec 2016, 5:34 AM
MD NOORULLAH RAZA
MD NOORULLAH RAZA - avatar
0
Actionlistener...when you put a value and Enter..it listen your action
21st Dec 2016, 5:42 PM
Somnath Ghosh
Somnath Ghosh - avatar