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

Public -> Because we want to access the main from the out side of the class generally when we run the java program at that time it call the main method.

Static ->Because it will create only one copy of main method and we can call with class name so when we run program it will
run main method using passed program name like name.main();

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is lifetime variable?

1017


What is a map in java?

1052


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

1141


What is the use of join method?

1085


What is a memory leak in java?

1127


What is meant by tab pans?

1330


Can we create our own daemon thread?

1030


What is method and methodology?

1158


Describe 2 different ways to concatenate two strings.

1263


How to provide security in java

2326


When throws keyword is used?

1044


Can you make a constructor final?

1074


How do I get the | symbol on my keyboard?

1122


Is string thread safe in java?

1141


How many types of flags are there?

1060