package staticmethods;

public class Methods3 {
    public static void main(String[] args) {

        /*
         * When you debug a program with a method, you'll see
         * that method's STACK FRAME in the Call Stack window.
         * The Variables window always shows the variables that
         * are locally defined inside the CURRENT STACK FRAME.
         *
         * A variable that is declared inside a method (including parameter
         * variables) is LOCAL to that method: it is not accessible/visible
         * to any code outside the method.
         * For example, what is the output of this code segment?
         */

        int n = 5;
        System.out.println("foo" + n);
        System.out.printf("Before method: %d\n", n);
        method(n);
        System.out.printf("After method: %d\n", n);
    }

    public static void method(int num) {
        num *= 2;
        int n = 77;
        System.out.printf("In method(): n is %d and num is %d\n",
                n, num);
    }
}
