Java launch error selection does not contain a main type

后端 未结 3 1995
生来不讨喜
生来不讨喜 2020-12-17 10:00

I am a total newbie in Java and Eclipse. I googled for lots of help but still confused. From Eclipse I click run then choose Java application and I get this error immediatel

3条回答
  •  生来不讨喜
    2020-12-17 10:37

    You cannot define the main method as you do in C++.

    For the Java interpreter, the main method must always be public and static. So you need to change your main method signature to

    public static void main(String args[])
    

    Try this, and feel free to ask further. :-)

提交回复
热议问题