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 the difference between ec2 and lambda?

956


Is jvm a compiler or an interpreter?

1101


What are the advantages of lambda functions?

1026


What is lambda used for?

926


What java systems libraries and methods are available for me to use?

897


Can the main method be overloaded?

1012


What is interceptors in java?

942


What is contextpath in java?

945


If you’re overriding the method equals() of an object, which other method you might also consider?

1003


Is java installed on windows 10?

949


How can I write a program that takes command line input?

933


What is transactional in java?

1092


What is the use of flatmap?

1027


What is mq in java?

943


What is jpa entitymanager?

1005