+ 1

How can we write multiple main functions in JAVA?

can a java program contain multiple main in what context we can use them?

8th Jul 2017, 3:49 PM
Chaitanya G V
Chaitanya G V - avatar
3 Answers
8th Jul 2017, 5:07 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 5
tl;dr - Yes, either through overloading, or by having multiple classes each with one main function in it. https://www.quora.com/Can-a-Java-program-contain-more-than-one-main-method-in-a-class
8th Jul 2017, 4:16 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Either by Overloading or not in only one class. But you can use Threads for some kind of 2 works with one main method
8th Jul 2017, 4:17 PM
Bruh