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
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback