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); } }