Skip to content

Instantly share code, notes, and snippets.

@pj8912
Created May 12, 2021 07:36
Show Gist options
  • Save pj8912/40f38ee5cf0a64fec4b4e349646b7b52 to your computer and use it in GitHub Desktop.
Save pj8912/40f38ee5cf0a64fec4b4e349646b7b52 to your computer and use it in GitHub Desktop.
why main method is static?
Java main() method is always static,
so that compiler can call it without the
creation of an object or before the creation of an object of the class. ... So, the compiler needs to call the main() method. If the main() is allowed to be non-static, then while calling the main() method JVM has to instantiate its clas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment