Search code examples
javaclassprogram-entry-pointterminology

What is the generic name for classes that are not the "main" class?


The "main" class marks the entry point of the program, often instantiating other classes in its main method. Is there a generic name for the classes that are not the "main" class?

I'm new to Java, and I'm trying to learn more about its terminology and haven't been able to find this information anywhere.


Solution

  • The "main" class marks the entry point of the program, often instantiating other classes in its main method. Is there a generic name for the classes that are not the "main" class?

    There is no standard "main" class. Or non-main. There are just classes.

    There may be some classes that have a method with signature public static void main(String[] args). These classes are executable with java package.TheClassName on the command line, or can be the designated main class declared in executable jar files. Often there is one such class in a project, but there can be as many as you want. There's no standard naming for these classes. (I call them runners.)

    Package authors have to explicitly document the package and name of these classes so that users can run them, because there's no standard way to guess them. Or else a runner script or an executable jar is provided to encapsulate the detail of the name (and parameters). Either way, the method of execution must always be documented, because it's not obvious.

    I'm new to Java, and I'm trying to learn more about its terminology and haven't been able to find this information anywhere.

    That's because there's nothing to find.