MethodExample

Updated Dani 0 Tallied Votes 200 Views Share

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;
    }
}
p.bondam 0 Newbie Poster

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.