0
how fuction the operator this
this in Java
2 ответов
0
The "this" operator is a nifty way of objects referring to themselves. In some cases, you will need to reference an object from within its own code, such as if you need to access an instance variable that shares a name with a locale variable.
For example:
public Something(int temp){
this.temp = temp;
}
The operator "this" denotes it is referencing an instance variable, and not the parameter "temp".
There are other uses, though you won't see them as often.