1.

Can I Have Multiple Main Methods In The Same Class?

Answer»

We can have MULTIPLE overloaded main methods but there can be only ONE main method with the following signature :
public STATIC void main(String[] args) {}
No the program fails to compile. The compiler says that the main method is ALREADY defined in the class.

We can have multiple overloaded main methods but there can be only one main method with the following signature :
public static void main(String[] args) {}
No the program fails to compile. The compiler says that the main method is already defined in the class.



Discussion

No Comment Found