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

In Java why we write public static void main(String args[])
why not main()?

Answer Posted / ankur

in java we write public static void main(String args[])
instead of just main because:....

public.....The main method must be public because it is
call from outside the class. It is called by jvm.

static....The main method must be static because without
creating an instace jvm can call it. If the main method is
non static then it is must to create an instance of the
class.

void....Main method doesn't return anything therefore it is
void also.

(String args[])....It is used for receiving any arbitirary
number of arguments and save it in the array.

Is This Answer Correct ?    429 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is downcasting?

1029


Which is dependent variable?

848


What do you mean by synchronized non access modifier?

950


What is the major difference between linkedlist and arraylist?

973


What is the purpose of using javap?

1045


Explain the hierarchy of java exception classes?

1028


What is treeset in java collection?

920


What are the basic concepts of OOPS in java?

980


Does variable declaration allocate memory?

992


Can we override private method?

1044


Can extern variables be initialized?

903


What is anagram of a string?

899


What comes to mind when someone mentions a shallow copy in java?

1065


String class is defined under which package in java?

1028


What is the difference between jdk and jre?

1012