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 / anil chahal

We write main method as static because we call this method
from class name. We are not instancing by making its object
so if we call from class name we must have to write static .
we write void because main method is return nothing.Public
because there is always only one main class that is one file
having only one main file, because this main file may be
used anywhere means
outside this package so public keyword is must.

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 void keyword?

1095


There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?

1481


Difference between a process and a program?

1108


What is not object oriented programming?

929


What is wrapper class example?

990


What is the difference between math floor and math round?

1028


What about interrupt() method of thread class ?

1064


What does %d do in java?

1034


What are the differences between path and classpath variables?

1033


What is the meaning of find and replace?

1027


Why map is used in java?

1022


What is use of static in java?

1153


How do you test a method for an exception using junit?

1195


what is singleton in java?

1039


Difference difference paint() and paintcomponent()?

988