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 / manik kumar bardhan

public means access specifier
static means
in general we always start execution from main()
but in java main() exist with in a class so when ever we r
executing any method which r within the class we need
instance variable to execute that method(a.print()) but here
without creating any instance main method will execute first
b/c static is the keyword which used for method then method
become a associated with class.for execution of that method
no need create instance.
void :return type
main is the method where java compiler starts execution.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a native method in java programming?

1074


How to find the largest value from the given array.

1013


Difference between arraylist and vector.

1132


What is javac_g?

1018


What is difference between char array and string?

1118


What is a java predicate?

970


What is type safety in java?

956


What is a class instance variable?

1128


Java is pass by value or pass by reference? Explain

994


Is sizeof a preprocessor?

1007


What is main difference between variable and constant?

1039


What is volatile data type?

1015


How do I find and replace in word?

982


What is the difference between iterator and list iterator?

1039


What are the two types of streams offered by java 8?

927