Loading

Q1.

What is the implicit superclass of all enums in Java ?
A. Object
B. Enum
C. String
D. Constants

Q2.

 What is the default base class of all enums in Java?

A. Object
B. Enum
C. AbstractEnum
D. Constant

Q3.

Which of the following is NOT true about enums in Java?

A. Enums can have constructors and methods.

B. Enums can implement interfaces.

C. Enums can extend another class.

D. Enum constants are implicitly public, static, and final.

Q4.

What will be the output of the following code?


enum Day { MONDAY, TUESDAY, WEDNESDAY }

public class Test {

    public static void main(String[] args) {

        Day d = Day.MONDAY;

        System.out.println(d);

    }

}

A. 0
B. MONDAY
C. 1
D. Compilation Error

Q5.

Which method returns all constants of an enum type in Java?

A. list()

B. values()

C. constants()

D. getEnum()