1.

Consider the below program, identify the output, and also state the reason for that.

Answer»

public class MAIN{public static void main(String[] args) { System.out.println(" Hello. Main METHOD. ");}public static void main(INT[] args) { System.out.println(" Hello. Main Method2. ");}}

The output of the above program will be Hello. Main Method. This is because JVM will always CALL the main method based on the definition it already has. Doesn't matter how many main methods we overload it will only EXECUTE one main method based on its declaration in JVM.



Discussion

No Comment Found