Menu
Topics Index
...
`

People names


If you need explanation Read this topic

If you need Answer Take test on this topic

People names
What will be the output of the following program?
public class People {
    public static void main(String[] args) {
        for (NAMES type : NAMES.values()) {
            switch (type) {
                default :
                    System.out.print(type + " ");
            }
        }
    }
}
enum NAMES {
    KIRAN("Kiran"), ASHOK("Ashok"), DHARMA("Dharma"), OLETI("Oleti");
    String str;
    NAMES(String str) {
        this.str = str;
    }
}

A. KIRAN ASHOK DHARMA OLETI
B. Kiran Ashok Dharma Oleti
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.

Ans A:here e num types will disply...

Posted by Ashok Reddi    2014-03-28 09:18:09


Ans :A because in switch case type is given so enum types will be displayed

Posted by Manasa Jyothi Sree    2014-03-28 10:03:51


Ans is B: as it returns value of enum...than enum itself

Posted by Jayachandra Gupta    2014-03-28 15:03:29


Congratulations Manasa Jyothi Sree. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-03-31 06:26:48


© meritcampus 2019

All Rights Reserved.

Open In App