What will be printed to console?

class Outer {
    public class Inner {
        enum Nums {
            ONE, TWO, THREE;
        }
    }

    public static void main(String... args) {
        for (Inner.Nums n : Inner.Nums.values()) {
            System.out.println(n);
        }
    }
}
Explanation
Inner classes can't declare enums.
If Inner is declared static, code would compile and print out
ONE
TWO
THREE

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes