What is the purpose of the "this" keyword in Java? Provide an example.
public class Example {
private int value;
public void setValue(int value) {
// Using "this" to refer to the instance variable
this.value = value;
}
}
The "this" keyword in Java is a reference variable referring to the current object. It is used to differentiate instance variables from local variables when they have the same name.