Is it possible for you to use two different int main () when writing a program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is it possible for you to use two different int main () when writing a program

1st Mar 2017, 12:24 AM
Charles Oselukwue
Charles Oselukwue - avatar
2 Answers
+ 14
No. The program will not compile in the first place, if you declared two main() functions.
1st Mar 2017, 12:26 AM
Hatsy Rei
Hatsy Rei - avatar
+ 11
The program starts at the main method. If you had two main methods, it won't know where to start.
1st Mar 2017, 1:55 AM
Jafca
Jafca - avatar