/home/wpollock1/public_html/Java/ScopeDemo.java

// Scope Demo - Shows what happens when a field and a local variable have
// overlapping scope.
// Written 10/2020 by Wayne Pollock, Tampa Florida USA

public class ScopeDemo {
     static int num = 22;  // Demo with and without static.

    public static void main ( String[] args ) {
        ScopeDemo sd = new ScopeDemo();
        sd.aMethod(17);
        System.out.println( ScopeDemo.num );
    }

     void aMethod( int x ) {
        int num = 17;
        System.out.println( this.num );  // Also show "ScopeDemo.num" and "num"
    }
}