/**
 * A simple example that demonstrates parameter passing
 *
 * @author  Prof. David Benrstein, James Madison University
 * @version 1.0
 */
public class ParameterPassingExample1
{
    public static void main(String[] args)
    {
	
    }


    //[0
    //
    //  This function will only swap the local copies
    //  of the parameters a and b
    //
    public static void swapNot(int a, int b)
    {
        int temp;


        temp = a;
        a    = b;
        b    = temp;
    }
    //]0



    //[1
    //  This function will swap the values of
    //  the instance variables a and b in the object p
    //
    public static void swapAttributes(Pair p)
    {
        int temp;


        temp = p.a;
        p.a  = p.b;
        p.b  = temp;
    }
    //]1


    //[2
    //  This method will only swap the local copies
    //  of the references to m and n
    //
    public static void swapNotObject(Pair m, Pair n)
    {
        Pair temp;


        temp = m;
        m    = n;
        n    = temp;
    }
    //]2
}
