@@ -0,0 +1,1358 @@
+package thirty_days_of_code;%0D%0A%0D%0Aimport java.lang.reflect.Method;%0D%0A%0D%0A/*%0D%0A * Problem Statement:%0D%0A * Generic methods are a very efficient way to handle multiple datatypes using a%0D%0A * single method.%0D%0A * %0D%0A * Let's say you have an integer array and a string array. You have to write a%0D%0A * single method printArray that can print all the elements of both arrays. The%0D%0A * method should be able to accept both integer arrays or string arrays.%0D%0A * %0D%0A * You are given code in the editor. Complete the code so that it prints the%0D%0A * following lines:%0D%0A * 1%0D%0A * 2%0D%0A * 3%0D%0A * Hello%0D%0A * World%0D%0A * %0D%0A * Do not use method overloading because your answer will not be accepted.%0D%0A */%0D%0Apublic class Generics %7B%0D%0A%0D%0A%09public static void main(String args%5B%5D) %7B%0D%0A%09%09Printer myPrinter = new Printer();%0D%0A%09%09Integer%5B%5D intArray = %7B 1, 2, 3 %7D;%0D%0A%09%09String%5B%5D stringArray = %7B %22Hello%22, %22World%22 %7D;%0D%0A%09%09myPrinter.printArray(intArray);%0D%0A%09%09myPrinter.printArray(stringArray);%0D%0A%09%09int count = 0;%0D%0A%09%09for (Method method : Printer.class.getDeclaredMethods()) %7B%0D%0A%09%09%09String name = method.getName();%0D%0A%09%09%09if (name.equals(%22printArray%22))%0D%0A%09%09%09%09count++;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09if (count %3E 1)%0D%0A%09%09%09System.out.println(%22Method overloading is not allowed!%22);%0D%0A%09%09assert count == 1;%0D%0A%0D%0A%09%7D%0D%0A%7D%0D%0A%0D%0Aclass Printer %7B%0D%0A    %0D%0A   public %3CT%3E void printArray(T%5B%5D arr) %7B%0D%0A       for (T o : arr) %7B%0D%0A           System.out.println(o);%0D%0A       %7D%0D%0A   %7D%0D%0A%7D

Add Generics