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 / b.prasad

1.we should give public bcoz the main() used my all
applications that r out side of application
2.we should give static bcoz it is instance method.so that
with out creating an object we can call it directly.and the
definition of the method should not been changed
3.we should give void bcoz the main() does not return any
value.ie void means return nothing
4.we should give args[],bcoz the main method takes some
arguments in the command prompt that are the string type and
also the jvm defines the signature of the main() is like that

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a java program to count the number of words present in a string?

937


How do you remove all elements from an arraylist in java?

946


Explain about oops concepts.

1066


What is the functionability stubs and skeletons?

1098


What does int argc char * argv [] mean?

929


What does java se mean?

964


Write a program to solve producer consumer problem in java?

948


Tell me a few examples of final classes defined in Java API?

1014


What does method mean?

963


Is arraylist a class in java?

993


What is natural ordering in java?

897


Why pointers are not used in java?

1045


How can I right-justify a string?

1091


What is var keyword ?

1124


How is Object Oriented Programming different from Procedure Oriented Programming?

985