0

Error: Main method not found in class, How can i use void without main method and don't get an error ?

I follow the example, it's not working and say Error: Main method not found in class Animal, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application i using eclipse

16th Sep 2016, 9:11 PM
Patipan Khwanchoo
Patipan Khwanchoo - avatar
2 Réponses
0
The main method is what is excecuted when you launch your program. Put a main method like indicated.
16th Sep 2016, 9:28 PM
Zen
Zen - avatar
0
This error occurs when you try to run a Java program that does not have a main method defined in its code. The main method is the entry point of a Java program, and without it, the program cannot be executed. To fix this error, you need to ensure that your Java program has a main method defined with the correct signature. The main method must be declared as public, static, and void, and take an array of String arguments. Here's an example of a valid main method declaration: public static void main(String[] args) { // code to be executed } Make sure that the main method is spelled correctly, and that it is located in the correct class file. https://net-informations.com/java/basics/main.htm
24th Apr 2023, 4:42 AM
rahul kumar
rahul kumar - avatar