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

Is java an open source?

930


What is the difference between a method and a procedure?

1000


Why is singleton class used?

986


Can a hashset contain duplicates java?

924


What is an object's lock and which object's have locks in java programming?

1000


How will you invoke any external process in java?

1048


What is singletonlist in java?

909


Using callable statement how can you pass out parameters, explain with example?

1169


What does it mean that strings are immutable?

1075


Is an integer an object?

905


When will you define a method as static in Java?

996


Why does java have different data types for integers and floating-point values?

952


Why charat is used in java?

986


What is bitwise complement?

928


Explain about varargs in java?

1058