java - How can i call a variable from another method -



java - How can i call a variable from another method -

i need know how phone call variable 1 method can help me?

public static void number(){ number = 1; } public static void callnumber(){ /*how can phone call number method??? */ }

actually, "call variable other method" not explicit, since variable in method either global (used in method naturally available in entire program), or local variable of method. , in lastly situation impossible value.

then either declare variable externally , trivial, or specifiy type value method "number()":

public static int number() { int number = ...; homecoming number; }

and phone call it:

public static void callnumber() { int numberreturned = number(); // other things... }

note: code number = 1; specifies variable global... trick set "number" available either return of method, or specifying variable global.

i don't know if i've answered question, if not seek more explicit.

java methods call

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -