Will this code be compile?

1: public class InnerExample {
2:    public class Inner {
3:         static final int x = 3;
4:         static int y = 4;
5:    }
6:    static class Nested {
7:         static int z = 5;
8:    }
9: }
Explanation
Inner classes can't have static fields without the final modifier, but nested static classes can.

Follow CodeGalaxy

Mobile Beta

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