This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi, this is Q) from Khalid, valid declarations of main() a) static void main(String args) b) public static int main(String args) c) public static void main(String args) d) final public static int main(String arguments) e) public int main(String args,int argc) f) public void main(String args) accr to me valid answers are a) and d) but answer given is only d) why not a) pls see below.. this runs and prints hi.. Please explain...
please use the [code][/code] tags when showing code. visit <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page" target="_blank" rel="nofollow">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page</a> ,for more details
For the purposes of SCJP exam you need to know the correct signature, which is an array of Strings, the correct return type which is void and the correct accessibility modifier which is public, and also static which belongs only to the class. declaring main as final doesn't change the above criteria. although your code works fine, giving main a default modifier, or even private for that mattar, it's not suitable for the purposes of SCJP.