You are viewing a single comment's thread. Return to all comments →
My solution, inspired by the solution of samah_mahdi_has1
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { printArray(Arrays.asList(1,2,3)); printArray(Arrays.asList("Hello", "World")); } public static <E> void printArray(List<E> elements){ elements.forEach(System.out::println); } }
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 →
My solution, inspired by the solution of samah_mahdi_has1