Java - Cannot find symbol constructor

前端 未结 5 517
我在风中等你
我在风中等你 2021-01-15 03:23

I\'m completely new to Java, so I\'m sorry if my question is dumb. Im working on this assignment, and I\'ve been reading about main methods for hours now, but I just cant fi

5条回答
  •  半阙折子戏
    2021-01-15 04:09

    What you tried to do in your main()-method was to create a new Player object. But the problem is that you had to use the constructor you implemented (Player(String, String)) but you used a constructor without any parameters (Player()).

    You should either use empty strings (e.g. if you want to get a player dummy)

    Player player = new Player("","");
    

    or you should give the new player instance the name and type you want to, so for example

    Player player = new Player("flashdrive2049","Player");
    

    Regards.

提交回复
热议问题