I\'ve been examining the Java Language Specification here (instead I should be out having a beer) and I am curious about what a method can contain. The specification states a me
Oh yes you can declare a class inside a method body. :-)
class A { public void doIt() { class B {} B b = new B(); System.out.println(b.getClass()); } }