第二阶段31--泛型_泛型方法_泛型方法与可变参数
public class MethodGeneric1 { public <T> void method(T...args){ for(T t:args){ System.out.println(t); } } } public class Test4 { public static void main(String[] args) { MethodGeneric1 methodGeneric = new MethodGeneric1(); String[] arr = new String[]{"a","b","c"}; Integer[] arr2 = new Integer[]{1,2,3}; methodGeneric.method(arr); methodGeneric.method(arr2); } }