The program below should while running output "flower count:3".
Which of A-E can be placed in the beginning of the main method?
import java.util.*;
public class X
{
public static void main(String argv[])
{
//What here?
String[] s = {"flower", "ring", "ball", "flower", "flower", "ring"};
for (int i = 0; i < s.length; ++i)
{
if (!x.containsKey(s[i]))
{
x.put(s[i], new Integer(1));
}
else
{
final int newCount = ((Integer) x.get(s[i])).intValue() + 1;
x.put(s[i], new Integer(newCount));
}
}
System.out.println("flower count:" + x.get("flower"));
}
}
A) Hashtable x = new Hashtable();
B) Map x = new Hashtable();
C) Properties x = new Properties()
D) HashMap x = new HashMap();
E) ArrayList x = new ArrayList();