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 we write public static void main (String args[])
in core java plz explain briefly??????????????????

Answer Posted / nilay

because in JAVA everything is within class and should be
called with classname(static methods) or with instance of
that class. but main is the first method to be called when
no instances are in memory so that is why it is static and
is called like <classname>.main() by System class. and it
must be public because it is called from outside enviornent
of current class file. String[] is for the command line
arguments that you pass when you run your java program
by "java .classfile arg1 arg2" so all arguments are
received here and for multiple arguments it is an array of
strings. it does not return anything so it's return type is
void.

Is This Answer Correct ?    17 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between member variables initialization and assignment in a constructor?

1249


What is encapsulation in java?

1100


Is it possible for yielded thread to get chance for its execution again ?

1022


Can we access instance variables within static methods ?

1082


How to convert string to byte array and vice versa?

1077


How to solve the problem of generating the unique hash keys with hash function?

1902


What is the symbol for space?

990


What is api data?

986


what is synchronization? : Java thread

1011


What's the purpose of using break in each case of switch statement?

970


What is java autoboxing?

938


What is a vector in java?

1020


Why is java so important?

1106


How java uses the string and stringbuffer classes?

1057


What does I ++ mean?

1061