There is no difference from doing:
//...
public void otherMethod(){
someMethod();
}
//...
to doing
//...
public void otherMethod(){
this.someMethod(); // `this` in this case refers to the class instance
}
//...
Now if you would have
class SomeClass {
public static void someMethod(){}
public void otherMethod(){
//Calling someMethod()
}
}
you could do:
//...
public void otherMethod(){
SomeClass.someMethod(); // as the method is static you don't need to call it from an instance using `this` or omitting the class
}
//...
And lastly this syntax SomeClass.this.someMethod(); would not be correct in all scenarios. An example of where this could be used (correct) is as follow:
class SomeClass {
public void someMethod(){}
public void otherMethod(){
//Calling someMethod()
}
class OtherClass {
public OtherClass() {
// OtherClass#someMethod hides SomeClass#someMethod so in order to call it it must be done like this
SomeClass.this.someMethod();
}
public void someMethod(){}
}
}
SomeClass.this.someMethod();SomeClass.this.someMethod()is a valid method call (for instance, non-static nested classes).class A{ void someMethod(){} class B{ B(){A.this.someMethod();} void someMethod(){} } }thesomeMethodinBhides the one inA, so you have to useA.thisto call it.