我对Java中的此运算符有疑问。在程序员会写这样的代码的情况下:Java - 'this'运算符
private int counter;
public Incrementor(int counter){
this.counter = counter;
}
它会更好,以避免阴影效应以及与此去:
private int counter;
public Incrementor(int startValue){
counter = startValue;
}
岂不此操作使该运营商在未来编程execrises过时了吗?
您已提问13个问题,但您不接受任何答案! –
'这个'不是操作员。 –
您可能仍然需要编写像if(someObject == this)...这样的代码,或者从内部类引用外部类的this。 – Vlad