+ 1

Is SoloLearn wrong???

So is c#'s main method "static void Main (){}" or "static PUBLIC void Main (){}" Edit: jw because a compiler i have on my phone rejects the main method unless its public

31st Dec 2018, 5:26 AM
Jigoku saru
Jigoku saru - avatar
1 Odpowiedź
+ 4
Main method can be both public or private, it is private by default, because it is the entrypoint of a program and therefore no other method needs to call it. But you can make it public if you want it to be called from another program, for example if you are creating some API! Remember that if no access modifier is specified it is private by default, so: static void Main(string[] args) it is private!
31st Dec 2018, 5:40 AM
Sekiro
Sekiro - avatar