// from https://www.hackerrank.com/challenges/30-generics

// Write a single generic function named printArray;
// this function must take an array of generic elements as a parameter.

import java.lang.reflect.Method;

class Solution {
  
  public static <E> void printArray(E[] genericArray) {
    for (int i = 0; i < genericArray.length; i++) {
      E element = genericArray[i];
      System.out.println(element);
    }
  }

  public static void main(String args[]){
    Integer[] intArray = { 1, 2, 3 };
    String[] stringArray = { "Hello", "World" };

    printArray( intArray  );
    printArray( stringArray );

    if(Solution.class.getDeclaredMethods().length > 2){
      System.out.println("You should only have 1 method named printArray.");
    }
  }
}

@@ -233,11 +233,9 @@
 n %7B%0A
-  
 %0A
+
   pu
@@ -289,16 +289,19 @@
 y) %7B%0A   
+ //
  for (in
@@ -344,16 +344,19 @@
 +) %7B%0A   
+ //
    E ele
@@ -379,16 +379,154 @@
 ray%5Bi%5D;%0A
+    //   System.out.println(element);%0A    // %7D%0A    // *************refactored below*****************%0A    for (E element : genericArray) %7B%0A
       Sy

Refactor generic.java