对于我的一项任务,我需要创建一个基于文本的冒险游戏。根据说明,它告诉我创建一个类型为location的播放器对象。我一直收到这个错误,为什么?
它表示该错误与名为player的位置对象有关。我得到的错误是:
Constructor Location in class Location cannot be applied to given types; required : java.lang.String found: no arguments reason: actual and formal argument lists differ in length.
这是我写的代码
public class Responder {
private ArrayList <String> description;
Random generator = new Random();
private int totalSticks;
private int temperature;
private Location player;
public Responder() {
description = new ArrayList <String>();
fillDescription();
generator = new Random();
temperature = 0;
totalSticks = 0;
player = new Location();
}
}