Menu
Question Index
...

What will be the output of following program?

public class EnumerationBoxing {
    public static void main(String[] arg) {
        Integer input = 1000;
        int input1 = input.byteValue();
        System.out.print(input1 + " ");
        Names names[] = Names.values();
        for (Names name : names) {
            System.out.print(name + " ");
        }
    }
}
enum Names {
    java(4), Merit(2), Campus(3);
    String name = "MeritCampus";
    int length;
    private Names(int length) {
        this.length = length;
    }
}


-24 java Merit Campus
1000 java Merit Campus
32 java Merit Campus
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