Problem: java.lang.NoSuchMethodException: main [class [Ljava.lang.String;] at java.lang.Class.getMethod(Class.java:2068) | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Problem: java.lang.NoSuchMethodException: main [class [Ljava.lang.String;] at java.lang.Class.getMethod(Class.java:2068)

The program says that there is no "main". How can I resolve this? Where should I put the main? https://code.sololearn.com/c5up3eMYFSa6/?ref=app

20th Nov 2019, 7:36 AM
Keima Katsuragi
Keima Katsuragi - avatar
2 Antworten
+ 4
You are free about where to put main method inside your class. You can put main in the beginning, before any other methods. Or as the last method after all the others. Just be sure it has valid signature of main method and access specifier.
20th Nov 2019, 7:47 AM
Ipang
0
"Illegal start of expression" public void start()
20th Nov 2019, 8:04 AM
Keima Katsuragi
Keima Katsuragi - avatar