lundi 17 décembre 2018

reflection in java with 2-dim arrays

How to define 2-dim array in reflection?

int[][] x={ {1,1,2},{1,1,2},{3,3,3}};
Class<?> c= Class.forName("Ex2");
Class nameClassArr = Class.forName("[[I");
Method methodcall1= c.getDeclaredMethod("biggestRect", nameClassArr );
Object invoke = methodcall1.invoke(c, x);

in this way I get error on x.

In class Ex2 I have a function "biggestRect" that her arguments is 2-dim array





Aucun commentaire:

Enregistrer un commentaire