Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class Cap {
    enum DAYS {
        THU, FRI, SAT, SUN, MON, TUE, WED;
    }
    public static void main(String[] args) {
        EnumSet es = EnumSet.range(DAYS.THU, DAYS.MON);
        System.out.println(es);
        es.add(DAYS.TUE);
        System.out.println(es);
    }
}


[FRI, MON, SAT, SUN, THU]
[FRI, MON, SAT, SUN, THU, TUE]
[THU, FRI, SAT, SUN, MON]
[THU, FRI, SAT, SUN, MON, TUE]
[FRI, SAT, SUN]
[FRI, SAT, SUN, TUE]
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java EnumSet

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App