I have this method defined within MatrixOperation class:
(我在MatrixOperation类中定义了此方法:)
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
:
(我尝试了这种方法,但是却遇到了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?
(如何做到这一点?)
ask by Curious Coder translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…