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 a private method of a superclass be declared within a subclass?

956


What is boolean keyword in java?

1069


Name and explain the types of ways which are used to pass arguments in any function in java.

1007


How can you read content from file in java?

961


How many types of memory areas are allocated by jvm?

975


List two java ide’s?

982


What is the point of java?

967


How does hashset work in java?

1056


what state does a thread enter when it terminates its processing? : Java thread

989


What is the difference between inheritance and encapsulation?

1090


Which class contains a method: cloneable or object?

992


Why lambda expression is used in java?

995


How is Object Oriented Programming different from Procedure Oriented Programming?

985


Does every java program need a main?

937


What is the name of the java compiler?

1003