
public class LambdaFunc {
   public static void main(String[] args) throws Throwable {
       test();
       test();
       try {
            Thread.sleep(200000);
       } catch (Exception e) { }
    }

    private static void test() {
          Runnable r = null;
          for (int index = 0; index < 100; index++) {
              r = LambdaFunc::testMethod;
              System.out.println(index + ": Func =  " + r);
              r.run();
          }        

          r = LambdaFunc::testMethod;
          System.out.println("Outside loop1, Func =  " + r);
          r.run();
          Runnable r2 = LambdaFunc::testMethod;
          System.out.println("Outside loop2 Func = " + r2);
          r2.run();

          r = LambdaFunc::testMethod;
          System.out.println("Outside loop3 Func = " + r);
          r.run();

    }

    private static void testMethod() {
        System.out.println("testMethod() called");
    }
}
