CodesJava

Easy learning with example program codes

can we declare main method as non static in java?


No, JVM invokes main method even before the instantiation of the class. As non-static members or methods cannot be called with the class name directly so main() method should be declared as static.

Java interview questions on main method

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki