Welcome to the Treehouse Community
Looking to learn something new?
Carlos Caro4,174 Points
If there is more than one class, and each class has a method called "Main". What method is executed first?
If the program has more than one class and each class has a method called "Main". Whats executed first? which class and which method?
Since the Main method is intended to be your "main" entry-point into the application, there can only one can be defined as your program's entry point. You can define multiple main methods and adjust the compiler settings to define the entry point or use command-line switches to choose one, but essentially it's still only using one "main" to get the job done. Defining more than one main is sometimes helpful for testing and different platform compilations, but you are probably better off by defining one main and branching out from there unless you're doing some fairly fancy stuff that requires quick changes of entry points to test things.