Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the need to declare main() method as static in Java?

Answer Posted / bsridhar1984

main() is the entry point of the java program for JVM. If it
is not static and have to call main method, JVM has to
create the object for that class. At this situation
constructor of that class will be entry point.

So that main() method of that class should be static. Then
only JVM can access the main method directly without
creating object of the program.

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is adoptopenjdk?

917


Can we use lambda without functional interface?

957


Why is javac not recognized?

883


What is jpa implementation?

893


Do I need to install jre if I have jdk?

891


What is numberformatexception in java?

890


What is persistence xml in java?

897


What is a service layer in java?

845


What is @resource annotation in java?

912


What is the difference between a jdk and a jvm?

912


How do I run a project in netbeans?

940


What is web xml java?

886


When do we go for java 8 stream api? Why do we need to use java 8 stream api in our projects?

976


How do I run a java project?

917


What is maven in java?

913