+ 2
Using static keyword with main()
Why do we use static keyword with the main() function, please, describe in brief?
6 ответов
+ 3
Somewhere I have read this explanation:
A static method belongs to the class and not only to the instance.
If the main method would be non static you would need to create an instance. But to create an instance you need the main method which executes your code.
+ 1
But we describe the statements in the main method, why would someone want to write a constructor for the main?
+ 1
Yes, you are right there are too many doubts about the main() method itself. Anyway, thanks for your assistance.
+ 1
Ok, if we are gonna call the main function using classname.main()(as it is static) in other class, what will happen then?