例如,如果我有 30 个运行者对象,它们都有一个 getTime
方法。我怎样才能做类似 runner[index ].getTime() = new Double Array
的事情?
最佳答案
简单的循环就可以了
double[] times = new double[runner.length];
for(int i=0; i<runner.length; i++) {
times[i] = runner[i].getTime();
}
关于java - 如何从对象数组创建 double 组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20381456/