Generics in Java appear in later versions of J2SE5, development platform: eclipse3.2+ jdk1.6 encountered an error with an IDE tool at one time using the Java generics, and then looked for the reason: eclipse3.2 the default compilation is to use 1.4 to create generics that do not use Java.
WORKAROUND: Window-->perfernces-->java-->compiler-->compiler compliance lever in Eclipse's menu
Change 1.4 to 5.0 or 6.0 (set according to JDK version).
Example:
1package fanxing;
2
3import java.util.Hashtable;
4
5public class Good<k,v> {
6
7/** *//**
8 * @param args
9 */
Ten public hashtable<k,v> h=new hashtable<k,v> ();
One public void put (k K, v V) {
H.put (K,V);
13}
Public V get (k k) {
Return H.get (k);
16}
17
public static void Main (string[] args) {
//TODO auto-generated method stub
good<string, string> TG = new good<string, string> ();
Tg.put ("Key", "value");
System.out.println (Tg.get ("key"));
23
24
25}
26
27}
28
Output: Value