实际和形式参数列表的长度不同,但它们的长度相同?

Actual and formal argument lists differ in length, but they're the same length?

好的,基本上我已经在城市上空创建了一些移动的不明飞行物。我对 Java 中的图形非常陌生,并且在我使用图形的 5 次中有 2 次发布了关于我的一些工作的问题。所以我的主要目标是确保 UFO 在碰撞时相互反弹,但我在代码的以下部分遇到此错误:

1 error found:
 [line: 56]
Error: method collision in class UFO cannot be applied to given types;
  required: no arguments
  found: UFO
  reason: actual and formal argument lists differ in length

代码部分:

  static UFO[]  swarm = new UFO[5]; //this is my UFO array attribute and it is static to work with the UFO collision method

    for (int i = 0; i < swarm.length; i++)
          for (int j = i+1; j<swarm.length; j++)
          swarm[i].collision(swarm[j]); 

collision() 方法必须按如下方式定义才能在您显示时调用:

void collision(UFO ufo) {
    // collision implementation
}

return 类型不必是 void (它可以是任何东西,包括 Object 实际上取决于它是否returns something), 但方法签名必须有一个 UFO.

类型的参数