How do I resolve execution errors in the java program?

Asked 3 months ago, Updated 3 months ago, 5 views

Error: Main method not found in class Ex22.Define the main method as follows:
public static void main (String[]args)
Alternatively, the JavaFX application class must extend javafx.application.Application
It says, but I don't know why I'm making an error when I run it even though it's compiled.
The program is as follows:

public class Ex22{

  public static void main() {

    int[]moneyList={121902,8302,55100};

    for(inti=0;i<moneyList.length;i++){

      System.out.println(moneyList[i]);

    }

    for (intm:moneyList) {

      System.out.println(m);

    }

  }

}

java

2022-09-30 11:10

2 Answers

You must include String[]args as the main method argument.


2022-09-30 11:10

If the project is a JavaFX application, you will need to extend the application class as warned.
"If the project is a normal Java project, you will need to specify the main method arguments as ""tokoi"" replied."

If you specify the IDE you are using, how you are trying to do it, and what you want to do, you will get a more specific answer.


2022-09-30 11:10

If you have any answers or tips


© 2023 OneMinuteCode. All rights reserved.