A short example of passing variables between methods (functions).

package methodexample;
public class MethodExample
public static void main(String args[])
int y = 2, z = 0;
z = twoTimes(2);
System.out.print("\n\n\t" + (y + z));
public static int twoTimes(int y)
y = 2 * y;
return y;

hi Queen,

this is really a very intriguing example...

what were you thinking at the time=

by the way...when in this comment/area, my keyboard is acting strange, showing equal/signs instead of question-marks, and slashes instead of minus/signs...and so on.
in my browser or java shell all is still ok.

any idea =;

greetings from

peter bondam