Switch on Enum does not import class
<p>Say I have an Enum as follows:</p>

<pre><code>package stackoverflow.models;

public enum MyEnum {
    VALUE_1,
    VALUE_2;
}
</code></pre>

<p>And then I have a POJO which has this Enum as one of its fields:</p>

<pre><code>package stackoverflow.models;

public class MyPojo {
    private MyEnum myEnum;

    public MyEnum getMyEnum() {
        return myEnum;
    }

    public void setMyEnum(MyEnum myEnum) {
        this.myEnum = myEnum;
    }
}
</code></pre>

<p>Now, should I do a <code>switch</code> on <code>MyPojo.getMyEnum()</code>, I do <strong>not</strong> need to import the Enum directly into my class:</p>

<pre><code>package stackoverflow.classes;

import stackoverflow.models.MyPojo;

public class MyClass {
    public static void main(final String... args) {
        final MyPojo pojo = new MyPojo();
        switch(pojo.getMyEnum()) {
        case VALUE_1:
            break;
        case VALUE_2:
            break;
        default:
            break;
        }
    }
}
</code></pre>

<p>I was just wondering why this is? How does Java resolve the Enum values if it doesn't import the Enum directly?</p>