posted on Saturday, July 31, 2004 12:31 PM by demiliani

Main and accessibility...

I want to take in evidence an interesting question launched by Adrian Florea on UgiDotNet: what's the reasons to have a Main method not public???

Adrian points the attention to the differences between the last specifications of Java and C#:

C# Language Specification, 2nd editionJava Language Specification, 2nd edition
10.1
"Specifically, the execution environment can access the application’s entry point regardless of its declared accessibility and regardless of the declared accessibility of its enclosing type declarations."
12.1.4
"The method main must be declared public, static, and void. It must accept a single argument that is an array of strings"

Any explanations? Thanks Adrian for the question...

Comments