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方法访问变量? –