public class FindInteger {
int x = 10;
int y = 20;
int z = 30 ;
int m1(int y, int z) {
int x = 15;
y = x + z;
this.y = y + 10;
IO.outputln("x: " + x + " y: " + y + " z: " + z);
return y;
}
void m2( ) {
int z=40;
int y = m1 (x, x);
if ( z < 50 ) {
int x = 90;
z = x + y;
}
x = x + y + z;
IO.outputln("x: " + x + " y: " + y + " z: " + z);
}
public static void main(String[ ] args){
FindInteger q = new FindInteger( );
q.m2( );
IO.outputln("x: " + q.x + " y: " + q.y + " z: " + q.z);
}
}
this is a full code of this particular class i wrote, however its giving me values which i dont agree with. It gives me
x: 15 y:25 z: 10
x: 150 y:25 z: 115
x: 150 y:35 z: 30
i dont understand this.. why is z=10? also why is z=30 on the last line?