Examveda

What will be the output of the following Java code?
import java.util.*;
class Bitset
{
    public static void main(String args[])
    {
        BitSet obj = new BitSet(5);
        for (int i = 0; i < 5; ++i)
            obj.set(i);
        obj.clear(2);
        System.out.print(obj);
    }
}

A. {0, 1, 3, 4}

B. {0, 1, 2, 4}

C. {0, 1, 2, 3, 4}

D. {0, 0, 0, 3, 4}

Answer: Option A


This Question Belongs to Java Program >> Collections Framework In Java

Join The Discussion

Related Questions on Collections Framework in java