我想要获得一个类生成的值,并让其他类使用它并实时更新它。这是我做过什么与生成数类:如何编辑另一个类的值?
public Integer red(int red){
this.red = red;
return red;
}
然后我叫
private int red;
在其他类我做:
int r = gui.red(); //Gui is the name of the original class
但它告诉我诠释着适用于它。如果我将它设置为0,它始终保持为零,而其他班级无法改变它。我怎样才能使这项工作正确?
为什么你不像'public int red()'返回一个原始的int? – user3437460