Java OCA OCP Practice Question 1131

Question

Which of the following are valid declarations?

Assume java.util.* is imported.

  • A. Vector<Map> v;
  • B. Set<String> s;
  • C. Map<String> m;
  • D. Map<String, String> m;


A, B, D.

Note

The angle-bracket notation is part of release JDK 5.0's generic collections.

The Map interface required two type parameters.




PreviousNext

Related