// Example to show that Java has static, not dynamic, nested scopes, // using an anonymous inner class. 2005-02-23 class Nested { public static void main(String[] args) { m(); } static void m() { Foo f; { final int y = 11; f = new Foo() { public int invoke(int x) { return x + y; }}; } { int y = 22; System.out.println(f.invoke(3)); } } } interface Foo { int invoke(int x); }