Which two are valid initialization statements?

Which two are valid initialization statements?

Which two are valid initialization statements?

A.
Map<String, String> m = newSortedMap<String, String>();

B.
Collection m = new TreeMap<Object, Object>();

C.
HashMap<Object, Object> m = newSortedMap<Object, Object>();

D.
SortedMap<Object, Object> m = new TreeMap<Object, Object> ();

E.
Hashtablem= new HashMap();

F.
Map<List, ArrayList> m = new Hashtable<List, ArrayList>();



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Charlie

Charlie

Class Hashtable extends Dictionary implements Serializable, Cloneable, Map
Interface SortedMap extends Map

Elaine

Elaine

and Collections has no relationship with Map, they’re two different things

Elaine

Elaine

and Collection has no relationship with Map, they’re two different things

iThKaRoh

iThKaRoh

SortedMap is abstract, cannot be instatiated. It’s not A neather C.
The corrects ones are…

tommy

tommy

Tried it. It is D and F!