public class Foo() {
public Foo() {
this.otherMethod();
otherMethod();
}
public void otherMethod() {
System.out.println("called");
}
}
------
Main:
Foo foo = new Foo();
두 호출은 예상하고, 그래서 당신은 다른 이상을 사용해야하는 특별한 경우가 을 알고 싶어한다.개체 메서드가 java에서 다른 개체 메서드를 호출 할 때 "this"키워드를 항상 사용해야합니까? <code>otherMethod</code> 작업에
"언제 내가 this
을 사용합니까?"라는 질문에 대답하기는 어렵지만이 경우 가장 논리적 인 옵션은 무엇이며 그 이유는 무엇입니까?