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

Why do we use regex?

960


What is procedure overloading?

2250


What is a substring of a string?

1095


What are constants?

1004


What do you mean by light weight and heavy weight components?

978


What is array list in java?

1030


What is the difference between numeric and integer?

957


What is an immutable object?

1050


How will you calculate the depth of a binary tree if the tree contains 15 nodes?

1038


How many static init can you have?

1150


What is composition in java?

1227


What is parsing a sentence?

1008


How does arraylist size increase in java?

1053


What is java virtual machine? Explain

973


How to pass arraylist to stored procedure in java?

1073