+ 1

Why the keyword static is used in main function?

28th Jan 2017, 7:19 AM
Sandeep Singh Negi
Sandeep Singh Negi - avatar
2 Respuestas
+ 2
When the JVM starts your program it accesses main() statically ie. YourProgram.main() without instantiating your main class.
28th Jan 2017, 7:25 AM
Blightedsage
Blightedsage - avatar
+ 1
The static keyword is used so that the JRE (Java Runtime Environment ) can start executing your program without creating a Object i. e. without creating the instance of the class.
28th Jan 2017, 8:29 AM
Arpan Lunawat
Arpan Lunawat - avatar