Now i'm playing around with reflection and encounter with not quite clear behavior for me.
Class<? extends List> listClass = ArrayList.class.asSubclass(List.class);
System.out.println(listClass.isInstance(ArrayList.class)); //print false
System.out.println(listClass.getSimpleName());// print ArrayList
Sorry if my question is stupid and isn't new but i can't understand why
listClass.isInstance(ArrayList.class)
return false, although
listClass.getSimpleName()
return ArrayList
Can someone explain this behavior? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire