java - Constructor and method error -


can check wrong in code? output should true, x still false..

seton(x , true); system.out.println(x); }  public static void seton(boolean mode, boolean onvalue) {      mode = onvalue;     } public static boolean x = false; 

i can't use x = onvalue, because have other mode use.

the method seton receives copy of x , sets it onvalue, doesn't change original x variable.

but doesn't need x parameter, presumably because it's in scope in class code in. set x onvalue without mode parameter.

public static void seton(boolean onvalue) {     x = onvalue; } 

Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -