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 / xyz

Public -> Because we want to access the main from the out side of the class generally when we run the java program at that time it call the main method.

Static ->Because it will create only one copy of main method and we can call with class name so when we run program it will
run main method using passed program name like name.main();

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is charat java?

903


Why stringbuffer is faster than string?

992


How do you convert bytes to character in java?

941


What are the disadvantages of using inner classes?

1054


Does list allow duplicates in java?

879


How do you declare an array in java?

980


What is field name?

942


What is a default method?

980


How java uses the string and stringbuffer classes?

997


How does predicate work in java?

932


Why string is called as immutable?

885


What is better - 'bit-shift a value' or 'multiply by 2'?

1119


Can we inherit inner class?

945


What is bubble sort in java?

989


What are anonymous inner classes?

960