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 do we need main method to execute a java program?

Answer Posted / javamasque

Main method is auto called by JVM. It is the place, where JVM enters into the class. It is called before the class is instantiated by its constructor. There are below reasons on its signature.
1. Public access modifier: it is visible to outer environment called JVM.
2. Static non-access modifier: it is called before the class is instantiated, hence JVM use class name to call the main method.
3. Void return type: It return no value to JVM.
4. String array parameter: It takes command line arguments.

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a static block throw exception?

1100


What are constants and how to create constants in java?

986


Explain public static void main(string args[]).

1186


Can a vector contain heterogenous objects?

1080


Can a class have a static inner class?

1087


Can two objects have same hashcode?

1006


What is hash code collision?

1055


What is the major advantage of external iteration over internal iteration?

1111


What is the definition of tree ?

1055


Can sleep() method causes another thread to sleep?

1045


Add a value x to array from index l to r where 0 <= l <= r <= n-1

1095


What is the base class of all exception classes in java?

1061


What is the difference between inner class and nested class?

1099


Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?

1041


What is string pool?

1135