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
How do you represent a space in regex java?
What is nextline method in java?
What is the difference between method overriding and overloading?
Explain serialization and deserialization in java?
Explain different types of wrapper classes in java?
Can we override private method in java?
What is module in oop?
What is json parser in java?
Why we use set in java?
Why is singleton class used?
What is Session reduplication and how its done?
What is join () in java?
Is arraylist zero based?
Why is boolean important?
What is formatted output in java?