Register now or log in to join your professional community.
No, we can use one main function in a program
Yes, We can But Only One Main will be executed
You can't run the2 mains in the same time!!!!!
exp:
# Define case1
.........
# ifdef case1
int main()//main1
#else
int main() //main2
#endif
Hi,
No, we cant use more than1 main method in a class because compiler first look for main method to compile and start progam invocation. If two main method persists then it will throw error "Main Method is Already exists"
No.
EXPLANATATION:
1)The Program fails to compile.The compiler says that main method is already defined in the class.
2)But it is possible to OVERLOAD the main method.
No we can't use more than1 main in java..because main method is use to print..