aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please Help, need clarification about K&B book Self-Test Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Please Help, need clarification about K&B book Self-Test Questions" Watch "Please Help, need clarification about K&B book Self-Test Questions" New topic
Author

Please Help, need clarification about K&B book Self-Test Questions

David Yu
Greenhorn

Joined: Oct 28, 2006
Posts: 24
Hi everyone,

I finished the K&B book during my week of vacation, studied key points and wrote the mock exam. Results wasn't that great, I achieved a mark of 56 percent which fell short of passing by 3 percent. I read in other posts that the real exam specifies the number of correct answers. Hopefully that will make selection easier. I plan to try several more mock exams before writing the actual one. By the way, for those who passed the exam, how difficult is the real exam compared to the K&B mock exam? despite studying hard, I still failed which I am a bit disappointed about.

While trying the Self-Test questions of the K&B, I stumbled upon a number of questions. I will greatly appreciate it if anyone can provide any clarification.

Solution to Question 7 on p.269:
segment of code contains 2 arrays: a string array and an array of long values. Is it okay to use either an object or array of objects as the reference variable of arrays?

Solution to Question 9 on P.271:
the last line where it says "System.out.println(tooth);", how does the compiler know whether to use the static variable or the local variable?

Solution to Question 12 on p.517
I am wondering what does the File.separtor do? I try looking it up on the internet but the explanation is a bit vague

Solution to Question 13 on p.752
the answer states that an "IllegalThreadStateException is thrown when the code does not acquire a lock on the object before calling wait()". However, on p.721, it states "if the thread calling wait() does not own the lock, it will throw an IllegalMonitorStateException, an unchecked exception". So which one is it, IllegalThreadState or IllegaalMonitorState? it makes a huge difference because one of them is an unchecked which does not need to be handled.


Thank you for your time. =)
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
First off, have you checked the K & B errata (see link at the top of this forum)?


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

Joined: Aug 03, 2002
Posts: 7729
File.separator is simply a string with a File.separatorChar in it.
Documented in java.io.File API:
separatorChar

public static final char separatorChar

The system-dependent default name-separator character. This field is initialized to contain the first character of the value of the system property file.separator. On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\\'.
Valery Lezhebokov
Ranch Hand

Joined: Jun 12, 2006
Posts: 39
Originally posted by David Yu:

Solution to Question 7 on p.269:
segment of code contains 2 arrays: a string array and an array of long values. Is it okay to use either an object or array of objects as the reference variable of arrays?


Any array is an Object. =>
Is it okay to use either an object - yes
Array of objects - yes for strings, no for long arrays


Solution to Question 9 on P.271:
the last line where it says "System.out.println(tooth);", how does the compiler know whether to use the static variable or the local variable?

read about shadowing...


SCJP 1.5, OCE EJB 3.x
Valery Lezhebokov
Ranch Hand

Joined: Jun 12, 2006
Posts: 39
and as for the last question: IllegalMonitorStateException
David Yu
Greenhorn

Joined: Oct 28, 2006
Posts: 24
Thanks a lot for the rapid responses, greatly appreciate it.

I am just going to ask one more question instead of opening another forum topic. Is it okay to mark an overridden method as final? I thought that overridden method has to be less restrictive than the superclass method. However, on the K&B mock exam, it states on one of the questions that it's okay to mark an overridden method as final.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Please, in future, do use separate topics, otherwise the thread gets confusing.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Yes. final prevents someone overriding the subclass' method any further. The access qualifiers private, package (default), protected, public have nothing to do with the method being final.
[ December 18, 2006: Message edited by: Barry Gaunt ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please Help, need clarification about K&B book Self-Test Questions
 
Similar Threads
Need Clarification on Mock SCJP Exam Questions
Passed OCPJP6
sample questions on Sun site
Finally cleared SCJP 95%
Sun Cirtification