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

Can we call the run() method instead of start()?

1083


How do you convert string to int in java?

1138


What isan abstract class and when do you use it?

1665


What is string example?

1106


Are static members inherited to sub classes?

1186


What are constants?

1102


What is public/private protected in java?

1080


What is a instance variable in java?

1083


Is there any way to skip finally block of exception even if some exception occurs in the exception block?

1115


Is singleton thread safe in java?

1018


What is the list interface?

1124


What do heavy weight components mean in java programming?

994


What is a void in java?

1256


Tell us something about different types of casting?

990


Is it safe to install java on my computer?

1223