ADVANCED TOPICS IN COMPILER DESIGN
CODE GENERATION FOR OBJECT ORIENTED LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
True
|
|
False
|
|
Either A or B
|
|
None of the above
|
Detailed explanation-1: -the answer is No because the main is a static method and the static method cannot be overridden in Java.
Detailed explanation-2: -The short answer to, can we overload main method in Java is Yes, we can overload the main() method in Java. A Java class can have any number of overloaded main() methods.
Detailed explanation-3: -The answer is, yes, we can overload the main() method.
Detailed explanation-4: -Overriding main method You cannot override static methods and since the public static void main() method is static we cannot override it.
Detailed explanation-5: -Yes, we can overload the main method in Java, but When we execute the class JVM starts execution with public static void main(String[] args) method.