Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

You must declared Main class which contains 'main' method, which is entry point of program execution.in java

+2 votes
asked Aug 1, 2023 by Mr.mani Roy (150 points)

1 Answer

0 votes
answered Aug 3, 2023 by Peter Minarik (86,240 points)

Exactly as the error message says. You need a class that is called Main and it must have a method with the signature public static void main(String[] args).

If you start a new project in OnlineGDB and select the language Java (in the top-right corner), this is exactly what will be provided to you.

I'll copy it here, just for reference:

public class Main
{
    public static void main(String[] args)
    {
        System.out.println("Hello World");
    }
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...