main method is declared as static .justify
Answers
Answered by
4
Reasons:
1. Since main method is static Java virtual Machine can call it without creating any instance of class which contains main method.
2. Since C and C++ also has similar main method which serves as entry point for program execution, following that convention will only help Java.
3. If main method were not declared static than JVM has to create instance of main Class and since constructor can be overloaded and can have arguments there would not be any certain and consistent way for JVM to find main method in Java.
✌✌ hope this helps you ✌✌
1. Since main method is static Java virtual Machine can call it without creating any instance of class which contains main method.
2. Since C and C++ also has similar main method which serves as entry point for program execution, following that convention will only help Java.
3. If main method were not declared static than JVM has to create instance of main Class and since constructor can be overloaded and can have arguments there would not be any certain and consistent way for JVM to find main method in Java.
✌✌ hope this helps you ✌✌
Similar questions
Math,
7 months ago
English,
7 months ago
Math,
1 year ago
Business Studies,
1 year ago
Physics,
1 year ago