A short example of passing variables between methods (functions).
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;
While pursuing a Computer Science degree, I founded DaniWeb.com, an online community for developers and IT professionals. I coded the backend platform from the ground up and I also do all of the advertising sales and SEO. I'm a super-geeky programmer with a passion for Internet marketing.
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 =;
Isn't it about time forums rewarded their contributors?
Contribute to this discussion and earn rewards points that can be cashed out for dollars.
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.