Two Laptop Bag*
The moose likes JDBC and the fly likes regarding the static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "regarding the static" Watch "regarding the static" New topic
Author

regarding the static

narayana satish
Greenhorn

Joined: Dec 21, 2000
Posts: 25
I am a new person to Java. Why we are using static in the main function.Is it necessary,if so why.If not why...
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Defining a function as static means the function can execute without an instance of the class being created. This is why main is declared as static. It is where execution of a program begins, and it should execute even if no instances of the class are created.

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: regarding the static