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.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты