Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
enum types
:
Мова контенту: English
Русский
What will be displayed with the following code? import java.util.EnumMap; import java.util.Map; enum Types { A, B, C } public class Test { static Integer value; public static void main(String args[]) { Map<Types, Integer> m = new EnumMap<Types, Integer>(Types.class); m.put(Types.A, value); System.out.println(m); } }
enum types
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); } } }
enum types
What will be the result of compilation and execution of the following code? public class Test { enum Enum { ONE("oneInfo"), TWO("twoInfo"), THREE("threeInfo"); private static String info = ""; //1 Enum(String info) { this.info = info; //2 } public static String getInfo() { return info; } } public static void main(String[] args) { System.out.println(Enum.TWO.getInfo()); // 3 } }
enum types
What is the result of compilation and execution of the following code? enum Fish { GOLDFISH, ANGELFISH, GUPPY; } public class EnumTest2{ public static void main(String[] args){ Fish f = Fish.valueOf("GUPPY"); if (f == Fish.GUPPY) System.out.println("Are equal"); if (f.equals(Fish.GUPPY)) System.out.println("Are equal"); } }
enum types
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()); } }
enum types
What will be the result of compilation and execution of the following code? public class Test { enum EnumTest { VALUE1 { public EnumTest getValue() { return VALUE2.getValue().getValue(); } }, VALUE2 { public EnumTest getValue() { return VALUE1; } }; abstract EnumTest getValue(); } public static void main(String... args) { System.out.println(EnumTest.VALUE1); System.out.println(EnumTest.VALUE2); System.out.println(EnumTest.VALUE1.getValue()); System.out.println(EnumTest.VALUE2.getValue()); } }
enum types
← Попередня
1
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести