| 1 | package genclass; |
| 2 | |
| 3 | public class GenClassMethod { |
| 4 | public static <T> void printItems(T[] arr) { |
| 5 | for (int i = 0; i < arr.length; i++) { |
| 6 | System.out.print(arr[i] + " "); |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | public static void main(String[] args) { |
| 11 | // TODO Auto-generated method stub |
| 12 | String arr1[] = {"Cat", "Mouse", "Dog"}; |
| 13 | Integer arr2[] = {1, 2, 3}; |
| 14 | Double arr3[] = {10.5, 3.33, 7.33}; |
| 15 | |
| 16 | GenClassMethod.printItems(arr1); |
| 17 | GenClassMethod.printItems(arr2); |
| 18 | GenClassMethod.printItems(arr3); |
| 19 | |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // Using generic program, implement a stack |
nothing calls this directly
no outgoing calls
no test coverage detected