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 do you understand by looping in java? Explain the different types of loops.

1052


Which api is provided by java for operations on set of objects?

1462


What are wrapper classes in java?

1079


What does isempty () do in java?

1064


Can classes declared using the abstract keyword cab be instantiated?

1051


Which variable is the independent variable?

984


Why is it called a string?

1013


Can we have multiple classes in a single file?

983


Explain about the select method with an example?

1183


What is args length in java?

1174


What is the size of boolean variable?

1079


How to Sort Strings which are given in List and display in ascending order without using java api.

4439


Which is a valid identifier?

1212


Variable of the boolean type is automatically initialized as?

1011


What is string in java is it a data type?

1022