/**
 * Class to test what sort of communication between
 * local classes and the enclosing  method's local variables.
 * This experiment does not explore access to instance/static
 * variables and methods in the outer class.
 * They behave like anonymous inner classes.
 * @author Roedy Green
 */

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Outer
   {

   static void osm()
      {
      int oi = 0;
      final int ofi = 1;

      // Local Inner Class
      class LIC1
         {

         public void amethod(  )
            {
            // local class method can directly
            // see local variable ofi of calling osm method.
            int ifi = ofi;

            // illegal, only final local vars may be accessed
            // int ii = oi;
            // oi = i;
            } // end amethod
         }; // end LIC1
      LIC1 lic1 = new LIC1().amethod();

      } // end osm

   // the rules are the same for outer instance and static methods

   void oim()
      {
      int oi = 0;
      final int ofi = 1;

      // Local Inner Class
      class LIC2
         {

         public void amethod(  )
            {
            // local class method can directly
            // see local variable ofi of calling osm method.
            int ifi = ofi;

            // illegal, only final local vars may be accessed
            // int ii = oi;
            // oi = i;
            } // end amethod
         }; // end LIC2
       LIC2 lic2 = new LIC2().amethod()
      } // end osm

   } // end Outer