1
我也許一個愚蠢的問題,我想從方法訪問本地屬性,例如:獲得財產 - Java的
public class Example {
private int myprop;
public int getMyprop() {
return myprop;
}
public void setMyprop(int myprop) {
this.myprop= myprop;
}
public void useProperty(){
// i want to use here the variable: 'myprop' how i can accomplish this?
}
}
感謝您的時間。
修復你'get'方法。 –
您可以直接或通過吸氣劑使用此變量(修復後)。 –
對不起,如果我修復,我只是用我的get方法訪問變量? –