0
what is the function of "this" keyword??
2 Answers
+ 2
class Client(){
private String name;
public void setName(String name){
this.name = name;
//this.name = class variable
//name in method = parameter
}
}
+ 1
What is this?
this is a keyword in Java. It can be used inside the Method or constructor of Class. It(this) works as a reference to the current Object whose Method or constructor is being invoked. The this keyword can be used to refer to any member of the current object from within an instance Method or a constructor.
http://javabeginnerstutorial.com/core-java-tutorial/this-keyword-in-java/