// ScopeDemo.java
// This program contains two DISTINCT variables
// both with the name i, one an instance variable
// and the other a local variable.
public class ScopeDemo
{
private int i;
public ScopeDemo()
{
int i = 5;
System.out.println("In constructor, i=" + i);
} // constructor
public void someMethod()
{
System.out.println("In someMethod, i=" + i);
} // method someMethod
public static void main(String[] args)
{
ScopeDemo x = new ScopeDemo();
x.someMethod();
} // method main
} // class ScopeDemo