consider
public class awah{
private int x=0;
private int y;
private int w;
public awah(int width){
w=width;
}
public void sety(){
y=(Int)(Math.random()*4);}//meth1
public int gety(){
return y;
}
public void setx (){
x+=this.gety();
}
public int getx(){
return x;
}
public void showUpdate(){
System.out.println(x);
}
}//end of awah
public static void main(String[] args){
awah m = new awah(5);
m.showUpdate();
}
I expected the update to show the updated value of x+y but it doesn't
I want to be able to update the variable x whenever y is set to some random number
//frustrated