1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import java.util.*; public class Main { public static void main(String[] args) { Integer[] numbers = {1, 2, 3, 4, 5}; Main.<Integer>dispArray(numbers); } public static <T> void dispArray(T[] a) { for (int i = 0; i < a.length; i++) { p(a[i]); } } public static <T> void p(T a) { System.out.println(a); } } |
1 2 3 4 5 |
1 2 3 4 5 |