I have a method:
public static void test(ArrayList<Object> list)
However, when I try to call:
test(new ArrayList<String>)
the compiler throws errors indicating no such method.
But the strange thing is, if I define another method:
public static void test(ArrayList<String> list)
compilers throws another error indicating the two methods share same signature. After this I even try:
if(new ArrayList<Object>().getClass().equals(new ArrayList<Resource>().getClass())){
System.out.println("same");
}
else {
}
The result indicates the two classes are the same.
Can someone explain it a little bit about the generic type for arraylist?