You are viewing a single comment's thread. Return to all comments →
import java.io.*; import java.util.*; public class Solution { private static <T> void printArray(T[] array) { for(T item: array) System.out.println(item); } public static void main(String[] args) { printArray(new Integer[]{1, 2, 3}); printArray(new String[]{"Hello", "World"}); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Generics
You are viewing a single comment's thread. Return to all comments →