或者,换句话说,类似这样的事情有什么问题-
new Method[] {Vector.add(), Vector.remove()}
Eclipse 不断告诉我需要参数。但我显然不想调用这些方法,我只想将它们用作对象!该怎么办?
最佳答案
这可行,我忍不住想知道,你用这个做什么?
new Method[] {
Vector.class.getMethod("add", Object.class),
Vector.class.getMethod("remove", Object.class)
};
关于java - Java中如何引用Method对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/426655/