public class ScopeTest { static int xValue = 5; // a "global" variable // (actually a class variable) public static void main (String args[]) { int yValue = 7; // a local variable System.out.print("Before calling helper1: "); System.out.print("xValue is " + xValue); System.out.println(" and yValue is " + yValue); int zValue = helper1(yValue); // another local variable System.out.print("After returning from helper1: zValue is " + zValue); System.out.println(" and xValue is still " + xValue); helper2(); System.out.println("After returning from helper2: xValue is now " + xValue); } public static int helper1 (int n) { System.out.print("Inside helper1: "); System.out.print("xValue is " + xValue); // refers to the class variable int xValue = n; // declare a new local variable // with the same name System.out.print(", n is " + n); System.out.println(", but this xValue is " + xValue); // which one is this? return 2*n; } public static void helper2 () { System.out.println("Inside helper2: "); xValue = 123; // assigns a new value to class variable } }