我有一个扩展实体的类 Player:
玩家:
public class Player extends Entity {
public Player(char initIcon, int initX, int initY) {
//empty constructor
}
...
实体:
public Entity(char initIcon, int initX, int initY) {
icon = initIcon;
x = initX;
y = initY;
}
...
这几乎是您所期望的,但是在编译时我收到一个错误,内容为
Player.java:2: error: constructor Entity in class Entity cannot be applied to the given types:
public Player(char initIcon, int initX, int initY)
required: char,int,int
found: no arguments
reason: actual and formal argument lists differ in length
但它显然确实有必要的论据。这里发生了什么?谢谢!