After reading gnat's answer to Why a static main method in Java and C#, rather than a constructor? I take his answer to mean that the purpose of a Java class with a static main method is to define a program entry point and that it is not meant to be the program itself.

There may be a better way to do this, but I usually have the class with the static main method to do something simple like this:

public class MenuLauncher
    public static void main(String[] args) {
        Menu menu = new Menu();

Would the code above be the best practice for OOP where the class with static main doesn't do much more than launch or start program logic contained within a separate non-static object; after-all main is static so wouldn't the MenuLauncher class itself be very limited? Since main is a starting point I don't see any other purpose for the class other than to be a point of entry.

Is there a Java naming convention commonly used for classes that contain a main method and serve the purpose of being a program entry-point?

  • 2
    I usually call mine Program. Commented Aug 12, 2013 at 21:45
  • 2
    I call it Main and it's generally less than 20 lines long (with a bit of exception catching and parameter parsing).
    – assylias
    Commented Aug 12, 2013 at 22:11
  • the last 5 I wrote were Test1, Test2, Test3, Test4, and Test5 :) Was writing some small tests and didn't want to spend time thinking up descriptive names as it was throwaway code anyway.
    – jwenting
    Commented Aug 13, 2013 at 5:20

2 Answers 2


No, there is no widely used naming conventions for this. Examples I have seen are Main, Application, XLauncher or X, where X is the name of the project/application.

And yes, I think it's good for this class to contain only the minimum logic/code necessary to set up the application and start it. But I'm sure there are a lot of God Objects and Big Balls of Mud out there with a main method tacked onto a multi thousand line monstrosity.

  • I know this is a few years later but your last sentence made me fall from my chair. Thank you for the laugh. Commented Feb 14, 2018 at 15:36
  • @user0000001: you're welcome! Commented Feb 14, 2018 at 15:43

They are called the Main-Class, whether or not they are called Main and whether or not they do little or much.

They usually have the logic required for starting up the program.

In CLI apps they usually validate parameters.

In Desktop app they open the main menu like yours or open the main window.

If you read the MANIFEST files in a jar file, you would find they are called that.

Manifest-Version: 1.0
Created-By: xxx
Built-By: xxx
Build-Jdk: 1.6.0_04
Main-Class: myPackage.MenuLauncher

Not the answer you're looking for? Browse other questions tagged or ask your own question.