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

The public keyword is an access specifier, which allows the
programmer to control the visibility of class members. When
a class member is preceded by public, then that member may
be accessed by code outside the class in which it is
declared.In this case, main( ) must be declared as public,
since it must be called by code outside of its class when
the program is started.

The keyword static allows main( ) to be called without
having to instantiate a particular instance of the class.
This is necessary since main( ) is called by the Java
interpreter before any objects are made.

The keyword void simply tells the compiler that main( )
does not return a value. As you will see, methods may also
return values.
about strings[] It takes no of arguements & stored in an
array ,input is of integer type it is taken as string. so
main takes arguments of type string.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which programming language is best in future?

964


What is the difference between the ">>" and " >>>" operators in java?

983


Is it possible to override the main method?

981


What is immutability in java?

1091


5 Coding best practices you learned in java?

1016


How many types of voids are there?

992


What is default constructors?

1005


Difference between nested and inner classes ?

1133


what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread

985


Which is bigger double or float?

972


What does file separator do in java?

1017


What is difference between an object and a class?

1126


What are the elements of java?

1012


What is variable and rules of variable?

1021


How many types of parsers are there?

1019