Menu
Question Index
...

What is the output of the following program?

public class Enum {
    enum Type {
        CAT("Cat"), DOG("Dog"), LION("Lion");
        String st;
        public Type(String st) {
            this.st = st;
        }
    }
    public static void main(String r[]) {
        for (Type type : Type.values()) {
            System.out.print(type.st + " ");
        }
    }
}


Cat Dog Lion
CAT DOG LION
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Enumeration

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App