Why do we use static keyword in the line public static void main(string args[]) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why do we use static keyword in the line public static void main(string args[])

3rd Sep 2016, 12:21 PM
Shubham Jain
Shubham Jain - avatar
3 Answers
+ 1
static keyword specifies that the class member( variable or method ) is unique. It has a single copy which is shared by all objects of the class. e g : main is unique method
3rd Sep 2016, 4:52 PM
Harsh
0
Because it is static function.Program calls main Method with ClassName.main(args[]);
3rd Sep 2016, 1:41 PM
bayram akdemir
bayram akdemir - avatar
0
methods mentioned with static keyword van be called directly with Class name. mentioning static to main method helps JVM to start execution of program.
3rd Sep 2016, 6:14 PM
Mahender
Mahender - avatar