Menu
Topics Index
...
`

Creating Enum class1777


If you need explanation Read this topic

If you need Answer Take test on this topic

Creating Enum class1777
What will be the output of the following program?
public class WeekDays {
    public enum Days {
        MON, TUE, WED, THU, FRI, SAT
    };
    public static void main(String[] args) {
        for (Days d : Days.values());
        Days[] d2 = Days.values();
        System.out.println(d2[2]);
    }
}

A. TUE
B. WED
C. Some other output
D. Output can not be determined
E. Compilation Error or Runtime Error
Topic: Java Enumeration

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

b

Posted by Ignacio Monllor    2014-07-18 03:41:39


Ans is B. As for loop has no statements. In d2 we are storing all the enum values. So d2[2] gives WED.

Posted by Gopinath Manchikanti    2014-07-18 04:42:53


Ans is B

Posted by Mah Suneel    2014-07-18 04:46:07


b

Posted by May Monn    2014-07-18 05:36:28


Congratulations Gopinath Manchikanti. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-07-21 04:19:01


© meritcampus 2019

All Rights Reserved.

Open In App