Search code examples
javarefactoringprogram-entry-point

In java, can "public static void main" be renamed or refactored?


I do not want to change the public static void ... String[] args part of the signature, but is it possible to "rename" this function (eg. just for fun)?

So the entry point for execution would be a function with another name.

Rename it to, like, boot (what would better reflect, if not being historical, the actual use for it in my particular case).


related

I'm interested in doing something different, but these questions are still interesting:

public static void main(String arg[ ] ) in java is it fixed?

Why the name main for function main()


Solution

  • No. The Java Language Specification says:

    A Java virtual machine starts execution by invoking the method main of some specified class, passing it a single argument, which is an array of strings.

    The JVM Specification says the same thing:

    The Java virtual machine then links the initial class, initializes it, and invokes the public class method void main(String[]).