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

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -