aspose file tools*
The moose likes Mock Exam Errata and the fly likes rhe Test Yourself Question #3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "rhe Test Yourself Question #3" Watch "rhe Test Yourself Question #3" New topic
Author

rhe Test Yourself Question #3

Annmarie Ziegler
Greenhorn

Joined: Apr 06, 2001
Posts: 21
The question asks for valid signatures for main method entry point of an application. According to answers, the following is correct :
public static int main (String [] arg)
It appears that it doesn't work (compiles correctly, but doesn't run).
Am I missing something?
Thanks
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527

The question asks for valid signatures for main method entry point of an application. According to answers, the following is correct :
public static int main (String [] arg)

No way. The compiler considers this as method but not main method, which is entry point of an application. It shouldnt return any value in main method, should return void.


SCJP 1.5, SCEA, ICED (287,484,486)
rajashree ghatak
Ranch Hand

Joined: Mar 10, 2001
Posts: 151
i agree with Anil.
the main method(which is the entry point for JVM) should not return anything and hence the return type should be void.
The main method with int as return type is a valid method signature but it is certainly not the entry point.
rajashree.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Oddly enough, Annmarie and I compared our "Complete Java 2 Certification" books and my copy says that the above is legal and her copy says that it is illegal. This is test yourself, chapter 1, question 3 (page 26). We have the same edition except at the bottom of the copyright page, her book says:
"10 9 8 7 6 5 4 3 2 1"
and mine says:
"10 9 8 7 6 5 4"
What do other copies of the book say about this question?
BTW, we checked the errata from the web site and it didn't mention anything about this.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Umesh Joglekar
Greenhorn

Joined: May 02, 2001
Posts: 16
One ending in 4 is the third printing
One ending in 1 is i think first printing
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rhe Test Yourself Question #3