Quality Testing

Quality is delighting customers

The main method in Java is not an extraterrestrial method. Apart from the fact that main() is like any other method and can be overloaded in a similar way, JVM always looks for the method signature to start the program. 

Views: 65

Reply to This

Replies to This Discussion

yes main() method can be overloaded in java program , jvm will execute main(String [] args)  method  by default

As per practices of software testing company, the Main method in Java can be overloaded, But JVM always call the original main method, it will never call overloaded main method. The main method should not be static as the static method cannot be overridden in Java.

If you declare a method with same name and signature its called method hiding. Of course, you can make the main method final in Java. JVM has no issue with that. Unlike any final method, you can not override main in Java. This is what most software testing companies to follow.


TTWT Magazine





© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service