public class Account {
String accountNo;
int age;
public boolean equals(Object o) { if(o == this) return true; if(o == null) return false; if(!(o instanceof Account)) return false; Account r = (Account) o; if(!this.accountNo.trim().equals(r.accountNo.trim())) { return false; } return true; }
}
7行目のthisは何を指すのですか?
7行目がはっきりしません。1)2)どちらでしょうか。
1)if(o == this) return true;
2)if(!this.accountNo.trim().equals(r.accountNo.trim())) {
質問の意図も不明瞭です。たとえばつぎの質問も含まれるのですか?
1)のthisと2)のthisは同じなのか?
さらに、2)のthisのaccountNoは何を指すのかも質問に含まれますか?
つまり、なぜ「7行目のthisは何を指すのですか?」という問いをたてなければならないかを説明してください。
失礼しました。単独のthisの質問なので1)if(o == this) return true;ですね。
回答2件
あなたの回答
tips
プレビュー