The method signature of a Java main() method is:
public static void main(String[] args){
...
}
Is the
Recently, similar question has been posted at Programmers.SE
Looking for a definitive answer from a primary or secondary source for why did (notably) Java and C# decide to have a static method as their entry point – rather than representing an application instance by an instance of an
Application
class, with the entry point being an appropriate constructor?
TL;DR part of the accepted answer is,
In Java, the reason of
public static void main(String[] args)
is that
- Gosling wanted
- the code written by someone experienced in C (not in Java)
- to be executed by someone used to running PostScript on NeWS
For C#, the reasoning is transitively similar so to speak. Language designers kept the program entry point syntax familiar for programmers coming from Java. As C# architect Anders Hejlsberg puts it,...our approach with C# has simply been to offer an alternative... to Java programmers...
...