✅ Method declaration, outside Main Vs inside main
Hello guys, consider the following code:
At first, I wrote the DisplayRandomNumbers() method outside the Main method but I got an error telling me that I can't call the DisplayRandomNumbers from a static context. Can someone explain why I got this error and why if I put the method inside the main method itself, it works fine. What's happening behind the scenes here?
At first, I wrote the DisplayRandomNumbers() method outside the Main method but I got an error telling me that I can't call the DisplayRandomNumbers from a static context. Can someone explain why I got this error and why if I put the method inside the main method itself, it works fine. What's happening behind the scenes here?