+ 1

Why main class is named like that in java, when i edit that and run, im facing error

public static void main(String[] args)

22nd Dec 2019, 6:21 PM
Dev Anand
3 ответов
+ 3
That is how it's designed. Every programming language needs an entry point for code execution. In Java it is the main() method. That is the method signature and it can be altered in few ways but still it's function remains same. The changes you can make- 1) String array name can be anything. 2) You can use (String...args). 3) You can interchange the position of public and static with each other. 4) You can include final after static. Any other alterations to the method signature will lead to an error. These above 4 changes makes no difference and the method signature still remains the entry point for program execution. The main method can be overloaded but cannot be overridden.
22nd Dec 2019, 6:49 PM
Avinesh
Avinesh - avatar
+ 1
~ swim ~ thanks, learnt something new👍
23rd Dec 2019, 1:35 AM
Avinesh
Avinesh - avatar