New course! Every coder should learn Generative AI!
Try a free lesson0
About static confusion
why main mehod needs to be static? Is it mandatory? Are there any other methods that needs to be static and why? Pls can anyone explain with a example.
2 Answers
+ 2
and static method has better performance than object method
+ 1
It has to be static cause there is no instance, I mean, an object pre-written; we only have the class, the program it's just about to start. Basically, main method need's to be mandatory static.