/*
静态方法不可以访问类上定义的泛型
如果静态方法操作的应用数据类型不确定,可以讲泛型定义在方法上*/
import java.util.*;
class demo
{
public static <T> T show(T t )
{
return t;
}
}
class GenericDemo
{
public static void main(String []args)
{
demo d= new demo();
Integer i=d.show(1);
System.out.println(i);
}
}
静态泛型方法
最新推荐文章于 2023-08-03 21:35:20 发布