           <p>Because to use the inner class, an instance of the enclosing class is required, ensuring that the non-static members exist (static members can be accessed anyway).</p>

            <p>Inner classes can also be marked as <code>private</code>, <code>protected</code> or without a modifier, so they are accessible only in the package. But most of the time, since they depend on the enclosing class, they are marked as <code>private</code>.</p>

            <p><code class="hljs"><span class="hljs-keyw