Computer Science, asked by pappu8186, 1 year ago

main method is declared as static .justify

Answers

Answered by ayush45474
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 ✌✌
Similar questions