Concept Flow - Main method as entry point
Program starts
Look for Main method
Execute Main method
Run code inside Main
Program ends
The program starts by looking for the Main method, then runs the code inside it, and finally ends.
using System; class Program { static void Main() { Console.WriteLine("Hello World"); } }
| Step | Action | Code Executed | Output |
|---|---|---|---|
| 1 | Program starts and looks for Main | N/A | |
| 2 | Main method is found and called | static void Main() | |
| 3 | Execute Console.WriteLine | Console.WriteLine("Hello World"); | Hello World |
| 4 | Main method ends | } | |
| 5 | Program ends | N/A |
| Variable | Start | After Step 3 | Final |
|---|---|---|---|
| No variables | N/A | N/A | N/A |
Main method is the program's entry point. Program starts by calling Main. Code inside Main runs first. Program ends when Main finishes. No code runs automatically outside Main.