Menu
Question Index
...

How should we declare a collection so that program will compile without error?

import java.util.*;

class MyClass {
}
public class MyGraphics {
    
    /* INSERT CODE HERE */

    public synchronized void addCollection(MyClass var1) {
        coll.add(var1);
    }
    public synchronized MyClass getCollection() {
        return coll.poll();
    }
}


Queue coll = new LinkedList();
LinkedList coll = new LinkedList();
Queue coll = new ProrityQueue();
Queue coll = new Queue();
None of the above

Doubts

Problems

Topic: Java Collection Framework - Collections In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App