+ 2
Why do have no change when I remove 'this'?
public void setAge(int a) { this.age = a; }
2 Réponses
+ 7
Because "this" represents the object itself so in the code above "this" represents to the object "age" so even if you remove that it is still the same
+ 7
'this' keyword is used to point the object of current class. In your code it will remain same if you remove it though. If you do operator overloading kinda things. this will help you alot.