aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt" Watch "doubt" New topic
Author

doubt

bani kaali
Ranch Hand

Joined: May 05, 2002
Posts: 42
hi,
can anyone pls tell me why we have to declare the main() method as static, taking a string array as an argument?
thanks
bani
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Because the Java Language Specification says so.
The method main must be declared public, static, and void. It must accept a single argument that is an array of strings.

[ July 12, 2002: Message edited by: Jessica Sant ]

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Charu Murali
Ranch Hand

Joined: Jul 12, 2002
Posts: 37
A static method is the one that will be called with out craeting any objects. Since we need the main method to be called before any objects are created, it should be decalred as static.

HTH
Charu.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubt