-
What is the output of this program?
import java.util.*;
public class Bitset_Example
{
public static void main(String args[])
{
BitSet object = new BitSet(10);
for (int K = 0; K < 6; ++K)
object.set(K);
object.clear(2);
System.out.print(object.length() + " " + object.size());
}
}
-
- 6 60
- 60 6
- 6 64
- 64 6
- None of these
Correct Option: C
object.length() returns the length allotted to object object at time of initialization and object.size() returns the size of current object object, each BitSet element is given 16 bits therefore the size is 4 * 16 = 64, whereas length is still 5.