What is the result of compilation and execution of the following code:

public enum CS {
	BIG, SMALL, HUGE {
		public String getCode() {
			return "b";
		}
		
		public int getSize() {
			return 100;
		}
	};
	
	public String getCode() {
		return "a";
	}
	
	public static void main(String[] args) {
		System.out.println(BIG);
		System.out.println(HUGE.getCode());
		System.out.println(HUGE.getSize());
	}
}
Explanation
Method getSize is added as a constant-specific body for HUGE, but it is not declared in class CS and therefore will not be accessible.
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback