I am running a simple java program and import java.util.Hashtable<Integer, String>;
will not compile. The command line says:
practice1.java:1: error: ';' expected
import java.util.Hashtable<Integer, String>;
^
1 error
But this doesn't make any sense.
Edit:
I tried import java.util.Hashtable;
, but it gave me an error:
Note: practice1.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
Just
import java.util.Hashtable;
But you really want to use Map
and probably HashMap
instead.
import java.util.HashMap;
import java.util.Map;
// ...
Map<Integer, String> myMap = new HashMap<>();