dimanche 1 décembre 2019

Java reflection - Invoke method with int[][] argument

I have this method defined within MatrixOperation class:

private static int getLargestSubMatrixSize(int[][] inputMatrix, int[][] arrResult){}

I need to invoke this method using reflection

I tried this approach, but I'm getting a NoSuchMethodException:

Method method = MatrixOperations.class.getMethod("getLargestSubMatrixSize", int[][].class, int[][].class);
method.setAccessible(true);
int maxCount = (int) method.invoke(null, inputMatrix, resultMatrix);

How can this be accomplished?





Aucun commentaire:

Enregistrer un commentaire