Menu
Question Index
...

What will be the output of the following program?

import java.util.LinkedHashSet;
public class GetSize {
    public static void main(String args[]) {
        LinkedHashSet linkedset = new LinkedHashSet(10);
        linkedset.add("paper");
        linkedset.add("pen");
        linkedset.add("pencil");
        linkedset.add("scale");
        System.out.println("Capacity of linkedset is : " + linkedset.size());
    }
}


Capacity of linkedset is : 4
Capacity of linkedset is : 10
Capacity of linkedset is : 16
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java LinkedHashSet

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App