<p>Slightly related to my <a href="https://stackoverflow.com/questions/267750/java-instance-variable-accessibility">other question</a>: What is the difference between the following:</p>

<pre><code>private class Joe
protected class Joe
public class Joe
class Joe
</code></pre>

<p>Once again, the difference between the last 2 is what I'm most interested in.</p>

A public class is accessible to a class in any package.
A class with default access (
```
class Joe
```
) is only visible to other classes in the same package.
The private and protected modifiers can only be applied to inner classes.
A private class is only visible to its enclosing class, and other inner classes in the same enclosing class.
A protected class is visible to other classes in the same package, and to classes that extend the enclosing class.