File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes Roberts/Heller/Ernest Ch. 6 questions 1 & 2 (pp. 192-3) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Mock Exam Errata
Reply Bookmark "Roberts/Heller/Ernest Ch. 6 questions 1 & 2 (pp. 192-3)" Watch "Roberts/Heller/Ernest Ch. 6 questions 1 & 2 (pp. 192-3)" New topic
Author

Roberts/Heller/Ernest Ch. 6 questions 1 & 2 (pp. 192-3)

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
Roberts/Heller/Ernest Ch. 6 questions 1 & 2 (pp. 192-3):
I'm not going to bother typing in both questions, but they both ask about lists of possible function declarations (either overloads or overrides), and ask which ones are legal. An example is:
<code><pre>A. public int aMethod(int a, int b) { }</pre></code>
All the given answers for both questions are incorrect, because all the methods are declared with non-void return types, yet none of the methods contains a return statement. In order for the given answers to make sense, pretend that each method contains a "return 0;", as in:
<code><pre>A. public int aMethod(int a, int b) { return 0; }</pre></code>
(or some other code, any other code as long as it contains a return using a suitable data type.)
This may be an obvious error such that people can easily tell what RHE really meant by the question, but it annoys me that I told them about this 3 reprintings ago, yet they still haven't included it in their errata.

"I'm not back." - Bill Harding, Twister
Harry Chawla
Ranch Hand

Joined: Jun 03, 2000
Posts: 97
Hi Jim
Thanks for observing it and bringing it to everyone's notice. That was a sharp observation but it helps us to keep this point in mind in the real exam.
Thanks.
KN
Ranch Hand

Joined: Aug 13, 2000
Posts: 66
Hi Jim,
I agree with you. If you don't specify the return statement with the suitable return type, it won't compile. But if this type of Question comes in the exam, how can we be sure that it's not asking us to test for the suitable modifiers, position of the return type etc. If we are asked to choose the legal method definitions, should we not pick this one?.
public int aMethod(int a){}
Can you please clear my doubt regarding this.
Regards,
Kiran.
 
 
subject: Roberts/Heller/Ernest Ch. 6 questions 1 & 2 (pp. 192-3)
 
Threads others viewed
java
Sorry for what i have written but...
overloading confusion
missing return statement?
Marcus Green - Qn : 23 - Doubt
IntelliJ Java IDE