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

DECRIPTION ABOUT PUBLIC:
The main method should be acceseible to every function
which is inside the package and outside the package. and it
is possible only if main method is declared as public

DECRIPTION ABOUT STATIC:
Static is a storage class. static allocates space for
its data and it is first step done after compilation. In
java main method is coded inside a class.. but compiler
need to call the main method first as it is one of the
protocol in ANSIC..
A method in the class without creating an instance can
be called only if the method is static.. so main method
should be static

DECRIPTION ABOUT VOID:
As main method returns nothing or empty main is declared
as void

DECRIPTION ABOUT STRING(ARGS[]):
In java every input is considered as string. even the
input is of integer type it is taken as string. so main
takes arguments of type string.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a package in java? List down various advantages of packages.

1195


Are arrays immutable in java?

1003


Give the hierarchy of inputstream and outputstream classes.

1048


Difference between throw and throws?

1047


what is collatration?

3232


What is a singleton class in Java?

982


What is the final field modifier?

930


Is 0 an irrational number?

997


What is static block?

1058


How many types of java are there?

927


How do you convert string to int in java?

1009


What are predicates in java 8?

970


Which eclipse is best for java?

957


Does constructor return any value?

970


What are the advantages of autoboxing?

974