dimanche 22 mars 2020

from "array version" of a class to the class with reflection in java

i.e. i have "[B" but I want "B" as a Class type I tried this:

String tmp = clazz.getName();
tmp=tmp.substring(1);
clazz=Class.forName(tmp);

but it doesn't work because I use B while it want byte I suppose

I want this code to work with every class not just byte.

Sorry for the bad explanations, I'm new to this. thanks in advance.





Aucun commentaire:

Enregistrer un commentaire