Why main ( ) method in Java is declared as static?

No comments

The static modifier means that it does not have to be instantiated to use it. Before a
program runs there are technically no objects created yet, so the main method, which is
the entry point for the application must be labeled static to tell the JVM that the method

     can be used without having first to create an instance of that class. So main method should be declared as follows:

public static void main (String[] args) { lots of your java code...}

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀