I always thought (assumed) that the Main
method was static because you cannot have multiple instances of it (Correct me if that's wrong). The Main
method is the start point of your program and thus you can have only one.
So if I have
class Program
{
static void Main(String[] args)
{ // something
}
}
class OtherClass
{
void Test()
{
Program p1 = new Program();
Program p2 = new Program();
Program p3 = new Program();
Program p4 = new Program();
}
}
all instances of Program will share the same Main
method and so there will always be one start point.
Am I correct? Because I just googled this out of curiosity and found DIFFERENT answers to it on the Internet.
Is this explanation ALSO correct for the main method being static?