title: JLS-8 Classes in Java Interfaces can only be on top most class
body: <p><a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3" rel="nofollow">http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3</a> defines that interfaces can only be defined on top most classes, while it allows abstract classes to be defined even within static methods. Why can't we define an interface inside a method, the same way we can define classes or abstract classes and final static variable constants?</p>
  
  <pre><code>public class HelloWorld {
  
      public static void main(String[] args) {
  
          class ThisWorks {
          }
  
          abstract class ThisAlsoWorks {
              public static final String key = "value";
          }
  
          interface ThisDoesntWork {
          }
  
      }
  }
  </code></pre>