class Demo<T>
{
public void show(T t)
{
System.out.println("show++"+t);
}
public void print(T t)
{
System.out.println("print--"+t);
}
}
class GenericDemo
{
public static void main(String[] args)
{
Demo<Integer> d = new Demo<Integer>();
d.show(new Integer(5));
d.print(2);
}
}
泛型类
最新推荐文章于 2025-01-30 16:24:39 发布