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");
}
}