java反射判断数组

if (c.isArray()) {
String canonicalName = c.getCanonicalName();
String className = canonicalName.substring(0, canonicalName.indexOf("["));

try {
if (canonicalName.indexOf("[") != canonicalName.lastIndexOf("[")) {
return null;
}

c = Class.forName(className);
} catch (Exception ex) {
return null;
}
}

你可能感兴趣的:(java反射)