1.匿名内部类
泛型还可以应用于内部类以及匿名内部类。下面的例子使用匿名内部类实现了Generator接口:
public class Customer {
private static long counter = 1;
private final long id = counter ++;
private Customer (){
}
public String toString(){
return "Customer" + id;
}
public static Generator<Customer> generator