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

Is jdk required for netbeans?

848


What is java net url?

783


What is @resource annotation in java?

854


What is flatmap in rxjs?

859


Does ms edge support java?

821


What happens when the parent process of a child process exits before the child ?

878


What is transient in java?

827


What is the use of entity class in java?

880


Is java built on c?

891


Explain the inheritance principle.

882


Why is lambda expression used?

832


What is singleton pattern in java?

808


What are the advantages of java 8’s date and time api over old date api and joda time api?

1004


What is the use of lambda functions?

883


Explain working of java virtual machine (jvm)?

952