/*
 * File: PrimitiveCall.java
 * Author: Java, Java, Java
 * Description: This application illustrates what happens
 *  when a parameter of a primitive type is modified within
 *  a method. Note that the parameter n in myMethod is assigned
 *  a value within the method. This has no effect on the
 *  corresponding argument (k), which will still have the value 5.
 *  When myMethod(k) is called in main(), k's value (5) is copied
 *  into the parameter n. 
 
 *  If you run this program, you should get the following output:
      main: k= 5
      myMethod: n= 5
      myMethod: n= 100
      main: k= 5
 */

public class PrimitiveCall
{
    public static void myMethod(int n) 
    {
        System.out.println("myMethod: n= " + n);
        n = 100;
        System.out.println("myMethod: n= " + n);
    } // myMethod()

    public static void main(String argv[])
    {
        int k = 5;
        System.out.println("main: k= " + k);
        myMethod(k);
        System.out.println("main: k= " + k);
    } // main()
} // PrimitiveCall
