Menu
Question Index
...

Write a program to get the elements as Set from the given ranges by using one of the Set interface methods.

Input (NUMBERS) Output (Set)
NUMBERS.ONE, NUMBERS.TEN [ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN]
NUMBERS.SEVEN, NUMBERS.TEN [SEVEN, EIGHT, NINE, TEN]
NUMBERS.TWO, NUMBERS.EIGHT [TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT]
null, NUMBERS.TEN null


import java.util.*;
class RangeOfEnumSet
{
    public static void main(String s[])
    {
        System.out.println("The elements from given range are: " + getRange(NUMBERS.FIVE, NUMBERS.TEN));

    }


    public static Set getRange(NUMBERS start, NUMBERS end) {
    }

}
enum NUMBERS {
ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN;
}

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