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...

Why is the main method static in Java?

Answer Posted / nashiinformaticssolutions

Java's main() function is static by default, allowing the compiler to call it either before or after creating a class object. The main () function is where the compiler begins programme execution in every Java programme. Thus, the main () method needs to be called by the compiler. If the main () method is permitted to be non-static, the JVM must instantiate its class when calling the function.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we declare main () method as non static?

967


Explain working of call by reference function invoking.

1016


What is method in java ?

1069


What are the advantages of java inner classes?

1063


What are the differences between graph and tree?

1114


What is the use of put method?

946


Does sprintf add a null terminator?

1087


What is charat ()?

931


What is a module function?

1085


What is boolean strategy?

1129


which pattern is default in scanner package?

2225


What is the use of static class?

1172


What does it mean that a method or field is “static”?

970


Can a class be private or protected in java?

1052


What is serialization in java?

1055