You are viewing a single comment's thread. Return to all comments →
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Integer[] int_arr = {1,2,3}; String [] str_arr = {"Hello", "World"}; printArray(int_arr); printArray(str_arr); } public static <E> void printArray(E[] elements){ for(E element : elements) System.out.println(element); } }
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 →