1.

What does Collections.emptySet() return?(a) Immutable Set(b) Mutable Set(c) The type of Set depends on the parameter passed to the emptySet() method(d) Null objectThe question was asked in class test.My question is from Data Structures-Set in portion java.util – The Collections Framework of Java

Answer»

Correct option is (a) Immutable Set

To EXPLAIN I WOULD say: Immutable Set is USEFUL in multithreaded environment. One does not need to DECLARE generic type collection. It is inferred by the context of METHOD call.



Discussion

No Comment Found

Related InterviewSolutions