Can I declare methods or classes in the main method. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Can I declare methods or classes in the main method.

I'm guessing this is why my compiler is rejecting the 'void's and 'args' in the main method. Any ideas plead?

9th Sep 2017, 9:42 AM
Humble
Humble - avatar
1 Resposta
+ 3
If Main method is static, then the methods you're trying to call must also be static. Example: static Main(string args) { myMethod(); } static void myMethod() { //insert stuff here.... }
9th Sep 2017, 11:13 AM
Bagshot
Bagshot - avatar