Reasons to use generic array over array of Object : I know two reason to use generic array over array of objects.

1. To restrict what type of objects can be inserted into the array

    List<Object> stringObjects = Arrays.asList("a",new Integer(5));
    List<String> genericStrings = Arrays.asList("a",new Integer(5));//compile error

2. To have access to the correct method in your IDE

    List<Object> stringObjects = Arrays.asList("a",new Integer(5));
    List<String> genericStrings = Arrays.asList("a");
    stringObjects.get(0).length();//compile error
    genericStrings.get(0).length();

When I gave this answer to an interview, but they didn't seem very happy with my answer.
 So are there any other reason to user Generics over Abstract Class in arrays?




