File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Modifiers for Main method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Modifiers for Main method" Watch "Modifiers for Main method" New topic

Modifiers for Main method

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1599
I heard 'final" can be prefixed to a main method. Can somebody tell me, what are the modifiers that can be added to LEGAL main method?

I searched for same in older threads, and was wondering why the following one was shifted else where???


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Mahendar Reddy
Ranch Hand

Joined: Sep 27, 2005
Posts: 73
As i know...
We should have "public static void" b4 main(String[] a)
We can also have "final/synchronized/strictfp" b4 'main'.but nothing else..

SCJP- 98%<br />SCWCD-92%
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
The Java Virtual Machine Specification says that main must be "public static void" For the SCJP examination that's all you need to know.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1599
Why do I always forget JLS-the best place to refer??? :roll:

Thanks barry.
I agree. Here's the link:
subject: Modifiers for Main method
It's not a secret anymore!