+ 1
What is the use of THIS keyword in java
4 Answers
+ 14
It's used to refer to the object you are working with.
+ 11
You're welcome!! ^-^/
+ 2
It references the current object in context.
::::EXAMPLE::::
class MyClass {
private String name = "";
public void setName(String name) {
this.name = name;
}
}
^In that example, "this.name" is referencing the name of this particular instance of the class.
+ 1
thanks alex