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 / madhu

public static void main()

Public:-->The method is public because it be accessible to
the JVM to begin execution of the program JVM is outside of
the class.

Static:--> It is Static because it be available for
execution without an object instance. you may know that you
need an object instance to invoke any method. So you cannot
begin execution of a class without its object if the main
method was not static

Void:--> It returns only a void because, once the main
method execution is over, the program terminates. So there
can be no data that can be returned by the Main method

Main:--> Main() is the entry point of the program. Rather
we can say it is the main gate to enter inside the
apartment. It should be public because the compiler need to
enter inside the method (The guest need to access the
apartment to reach the security guard).

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you download stubs from Remote place?

1788


Explain notifyall() method of object class ?

1090


What is singleton pattern?

1118


Why we use set in java?

1001


What do u mean by variable?

1052


What is a instance variable?

1062


Is it necessary that each try block must be followed by a catch block?

1019


What is charat ()?

931


What is a numeric format?

1094


What is an object class?

1026


How the metacharacters are different from the ordinary characters?

1021


Write a java program that prints all the values given at command-line.

1011


Can we clone singleton class in java?

958


Can an interface be defined inside a class?

1060


What is methodological theory?

996