File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Signature of main() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Signature of main() method" Watch "Signature of main() method" New topic

Signature of main() method

Thomas Markl
Ranch Hand

Joined: Mar 08, 2001
Posts: 192
class Test20 {
final static void public main(String args[] {} // ERROR!
// final static public void main(String args[]){ } // OK
Why this error?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Because before the method name there must stand the return type which is in this case void.
Peter Kristensson
Ranch Hand

Joined: Jul 02, 2001
Posts: 118
final static void public main(String args[] {} // ERROR
you forgot the closing right parenthesis.
I agree. Here's the link:
subject: Signature of main() method
It's not a secret anymore!