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

If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?

1183


explain multi-threading in java?

1033


What is the difference between throw and throws keywords?

1054


What is the definition of tree ?

1050


What is the argument in java?

928


Can we extend immutable class?

995


Can we declare a constructor as final?

1318


Are strings immutable in java?

990


What is qms certification?

956


What is exception in java?

1090


According to java operator precedence, which operator is considered to be with highest precedence?

1090


What are the 3 types of loops in java?

1087


What is string pool?

1130


Write an algorithm for quick sort?

1039


What is multithreading in java?

1057