The method main must be declared public, static, and void. It must accept a single argument that is an array of strings.
A mock exam should test your understanding of the Java Language Specification. In this specific case, the mock exam should also verify that you know that the Java Virtual Machine enforces this rule--not the compiler. Some older versions of the JDK do not enforce the rule. Even so, a mock exam should not promote the use of coding practices that violate the Java Language Specification. For the purposes of the exam, any declaration of the main method that is syntactically correct but in violation of the requirement to declare the main method as described in Section 12.1.4 of the JLS results in a run time error even if some versions of the JDK don't enforce the specification.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Joined: Feb 21, 2002
Thanks Dan for ur detail info...its really helpful... Also trying ur Mock exam....really tough .... Thanks guys...
Joined: Jul 02, 2002
Priya, Thank you for the feedback. Yes, most everyone that has written to me has said that my mock exam is more difficult than expected. For that reason, I have been working on developing new questions for the section titled "Basics" on the "Topic Exam" page. I would like to provide more easy questions for those that are just getting started and save the more difficult questions for those that are nearly ready for the real exam. That should allow both beginners and advanced programmers to get something of value from my mock exam page. I hope to get the next version of my exam up on the web within the next few days. It will probably have another 15 or 20 questions for the "Basics" section and about the same number of new questions for the other sections. The next version will also have a new section titled "New Questions". All of my questions are developed in a set of XML files--one xml file for each topic. Since the source documents are xml, I can use JDOM and XSLT to distribute the questions across the html documents any way that I like. In the next version of the exam, I'll sort out the new questions and put them into a separate document. The new section will allow people to come back to the mock exam to work through only the new questions.