What is the difference between
public static void Main()
and
private static void Main()
in a C# console appli
public and private are the access specifiers.
we use,
public static void Main()
because to execute the program, you need to call your class in which this Main() method is present, for that you need your Main() method to be public otherwise it will not be accessible outside the class.
And the reason why it is static is, because, it needs to be accessed without creating any objects of that class .i.e. at class level.