Why do we need main method to execute a java program?
Answer Posted / javamasque
Main method is auto called by JVM. It is the place, where JVM enters into the class. It is called before the class is instantiated by its constructor. There are below reasons on its signature.
1. Public access modifier: it is visible to outer environment called JVM.
2. Static non-access modifier: it is called before the class is instantiated, hence JVM use class name to call the main method.
3. Void return type: It return no value to JVM.
4. String array parameter: It takes command line arguments.
| Is This Answer Correct ? | 11 Yes | 1 No |
Post New Answer View All Answers
Is age discrete or continuous?
Explain exception chaining in java?
What is the purpose of nested class in java?
Is there any difference between synchronized methods and synchronized statements?
Why pass by reference is not possible in java?
Say any two properties in beans?
What are static methods?
What is the static variable?
What is int argc char * argv?
Which is bigger float or double?
What is the equal sign?
What are singleton services?
What is the statements?
What does int argc char * argv [] mean?
What is re-factoring in software?