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 the replace tool?

1167


What is numel matlab?

1337


What is the function of log?

1003


What are disadvantages of java?

1000


why Java does not support multiple inheritances?

1160


Difference between ‘is-a’ and ‘has-a’ relationship in java?

1006


Why singleton is not thread safe?

992


Can a constructor be protected?

1085


What is jvm? How its run?

1084


Mention the default values of all the elements of an array defined as an instance variable.

984


What does i ++ mean in Java?

953


what is the difference between preemptive scheduling and time slicing? : Java thread

1033


How to read and write image from a file ?

1044


How many types of string data types are there?

1093


What is autoboxing and unboxing?

1005