+ 3
Can anyone explain this operator plzzz....
with the help of a program
2 odpowiedzi
+ 14
The this keyword is used inside the class and refers to the current instance of the class, meaning it refers to the current object.
One of the common uses of this is to distinguish class members from other data, such as local or formal parameters of a method, as shown in the following example:
class Person {
private String name;
public Person(String name) {
this.name = name;
}
}
Here, this.name represents the member of the class, whereas name represents the parameter of the constructor.
Another common use of this is for passing the current instance to a method as parameter: ShowPersonInfo(this);
0
OK... Thanks man