You are viewing a single comment's thread. Return to all comments →
In the spirit of the challenge:
public static <T> void printArray(T[] array) { for( T e : array) { System.out.println(e); } } public static void main(String[] args) { Integer[] number = {1,2,3}; String[] s = {"Hello", "World"}; printArray(number); printArray(s); }
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 →
In the spirit of the challenge: