Which is preferable Sample.this.display() or this.display()?
class Sample{
void display(){
System.out.println("display() called");
}
void callDisplay(){
Sample.this.display(); // 1
this.display(); // 2
}
public static void main(String args[]){
Sample s = new Sample();
s.callDisplay();
}
}
- Can You explain the difference?
- Which is better choice?
- Is there any special meaning/purpose for Sample.this.display()?