Where will i put “Public static void main(String[] args)”?

前端 未结 4 1886
陌清茗
陌清茗 2021-01-17 00:54

I started coding java a few days ago. İ made a few succesfull programs but im stuck on this one. Where ever i write the \"Public static void main(String[] args)\" code i get

4条回答
  •  心在旅途
    2021-01-17 01:25

    Your syntax doesn't make any sense. You have a method called Board() seemingly inside your main() method, which isn't possible.

    It further doesn't make sense, because Board() is a constructor (notice it starts with an upper-case letter and has no return type), but I don't see a Board class here.

    You need to figure out exactly what you want to do: are you supposed to create a Board class? If so, that belongs in another file. Do you already have a Board class that you're trying to construct from the main() method? If so, then you call the constructor using the new keyword.

    Recommended reading: The Java Tutorials: Providing Constructors for Your Classes

提交回复
热议问题