title: Private class as return type from public method
body: <p>Why is this valid?</p>
  
  <p><strong>Foo.java</strong></p>
  
  <pre><code>public class Foo {
  
      public Bar getBar() {
          return new Bar();
      }
  
      private class Bar {}
  
  }
  </code></pre>
  
  <p>If Bar is private, how will users of this class use this method? Polymorphism can be used of course, but shouldn't this be invalid and the declaration should indicate this as returning an Object?</p>