我知道这很简单,但我真的不明白这个问题...
Assume the signature of the method xMethod is as follows. Explain two different ways to invoke xMethod:
public static void xMethod(double[] a)
我想调用您刚刚执行的方法:
xMethod(myarray);
用两种不同的方式提问意味着什么?也许我只是过度关注这个问题。
最佳答案
为了好玩,给你的教授看这个:
XClass.class.getMethod("xMethod", a.getClass()).invoke(null, a);
然后告诉他们这两个答案是
XClass.xMethod(a);
//and
xObject.xMethod(a); //this is bad practice
关于java - 基本的Java作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9675666/