I have a class Player that extends Entity:
Player:
public class Player extends Entity {
public Player(char initIcon, int initX, int initY) {
//empty constructor
}
...
Entity:
public Entity(char initIcon, int initX, int initY) {
icon = initIcon;
x = initX;
y = initY;
}
...
This is pretty much what you’d expect, but on compile I get an error that reads
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
But it clearly does have the required arguments. What’s going on here? Thanks!
You need to initialize super class by call its constructor with
super