Steven Squeers

Ranch Hand
+ Follow
since Aug 19, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steven Squeers

Nhien Nguyen wrote:Hi everyone,
Im studying for OCP using Sybex books. I just wondering how's the difficulty of the review questions at the end of chapter compare to Enthuware mock tests and the real exam.
I have done review question (1st time) in the book quiet well compared to the OCA book (which were challenging, really hard, but good for studying).

From memory they are much of a muchness. However, Enthuware grades its questions from very easy to real brainer, so you will always get a mix of difficulties on Enthuware's mock exams.  
You really have to do Enthuware (or something similar); you have no choice if you want to be well-prepared for the exam. And you might want to do another exam simulator as well.

Stephan van Hulst wrote:You can create conditions from locks using Lock.newCondition(). Condition has await and signal methods.

The explanation is silly though. You can release locks temporarily in synchronized blocks as well, by calling Object.wait(). It's a confusing text.

Yes this is true, as calling wait releases a lock, of course it does (sleep sleeps with the lock).

Thanks very much for the quick response.
In one of my OCP exam's question's answers it states that "Using ReentrantLock the thread can temporarily release the locks it has when it is going to a wait state"
Is this true? I haven't been able to find this in the API, nor googling for it, nor trying to make it so in a piece of working code.
Absent a method in eg Lock/ReentrantLock this would suggest that ReentrantLock has been somehow embedded into wait/notify which I find surprising, but it is confidently stated in the answer, so it must be true; perhaps I am misunderstanding the statement.


I see now what you mean; oracle is the name of the database vendor, but, not the name of the database in this context; the db name (which might be an sid or servicename in oracleland) follows the port, typically like this
To update my post, I went ahead and bought the simulator regardless, thinking that the other offerings would probably not be much different, and I just don't have the time or energy to compare and contrast exam simulators.
Having done the first practice exam, I can say that, although some of the language used is not exactly standard English (I think it's likely that it's created in a country where English is not the native language), I am pleased that I went ahead. The questions have found gaps in my knowledge, which is exactly the purpose for which it is intended.
I have not found any questions thus far that suffered from the shortcomings of the one in my initial post.
I've just done the practice exam, and as I was making my way through the questions, I thought, this doesn't look good.
One general gripe is that, unlike Enthuware, they don't allow you to copy-paste so that you can quickly play with the code in the questions, or copy any salient explanation points from the answers into your notes. With hundreds of questions, and details to know about each question, typing code examples out by hand just takes FOREVER.
But aside from that, it's worse than that. The fourth question on the free exam has the code (I had to type this out myself):

with 6 possible answers, two of which are exactly the SAME, and NONE of which is actually correct. I got the answer wrong, because the answer that I thought would be correct, is actually correct, but not in the list of possible answers. So I had to choose an answer that I was reasonably confident could not be the correct answer.

Enthuware is very good, but I've done Enthuware...if only there were another Enthuware....

Jeanne Boyarsky wrote:Steven,
I'm sure you read our rant in the chapter about what Scott and I think about the database topic coverage on the exam.

That said, you do not have to know the Oracle driver syntax on the exam. We used Oracle as the name in the example for the sake of picking something. What you do need to know is the simplified database url syntax. Knowing jdbc comes first and that a database name needs to be included is not memorizing the syntax. A and B don't have a database name at all.

Hi Jeanne
Thank you for your reply, and sorry for my delay in replying; I've been buried in my OCP studying and mock exams.
You said that A and B don't have a database name, but they all have a database name:

Hi Tim
Thanks for taking the time answer my question. I think what you say re the legal formats in practice is all absolutely true; the trouble is the question doesn't seem to be concerned with any of it.

FWIW I do think though that you're in danger of throwing the baby out with the bath water re the certs. What they do, especially for less experienced and newbie developers like myself, is force us to learn a *lot* of stuff quite deeply that we would almost certainly never have got round to learning ourselves; yes everyone learns on the job but I do feel that it's questions like this one that possibly give the wrong impression as to how useful the exams can be for ensuring decent foundational knowledge and competence in core java for newer developers.  

If you're not a practising, professional java developer, and especially if you're just learning java from scratch, these exams are pretty tough stuff.


OK so this is a question from the Sybex bank:

Which of the following is a valid JDBC URL?


I have seen a few of these questions now and I am quite worried that one of them is going to pop up on the exam. All I've seen in the book is that the url has to be:

The documentation for DriverManager.getConnection states the same, more or less:

url - a database url of the form jdbc:subprotocol:subname

So given that, how are we supposed to decide which of A,B and C is the "correct" answer? It gets worse because the given answer is:

A JDBC URL must begin with JDBC, making choices D, E, and F incorrect. The database name is required, making choices A and B incorrect. Therefore the answer is C.

It looks to me like A,B and C all have oracle in the name. All of them seem to conform to "a database url of the form jdbc:subprotocol:subname"

Can anybody shed any light on this murky area?  Thank you very much in advance.

OK yes, I get that. Sorry - it was just maybe the 2nd or 3rd question in a bank of 60 that I was taking, and so I thought, OMG, if they are all as bad as this I'm in real trouble.
But that was really the only one that I'd say was a bit...out there.

Thank you Jeanne.
There is so much to learn, in so much depth, that if one can economise safely, it is foolish not to do so, I think.
I have just started doing a practice exam. This is one of the questions:

Assuming in and out are properly defined and instantiated InputStream and OutputStream objects, respectively, which are true statements about the following code snippet? (Choose all that apply.)

Answer is

The code does not compile because the offset parameter is missing on line 5..... If the method signature on line 5 was changed to out.write(buffer,0,lengthRead), then the code would compile and run without issue

If we are supposed to know the exact signature for this method, why not for every method in the InputStream class. And if for every method in the IS class, why not for every method in OutputStream. And then, why not every method in BOS, BIS, FOS, FIS, Writer, Reader, BW, BR, FileWriter, FileReader, PrintStream, PrintWriter, , OOS, and OIS?
And then, for every class in the Collections API.
And then, for every class in java.util.concurrent.
And then, for every class in Files, every String method, every StringBuilder method.


Does anyone know if it's on the objectives for J8 OCP?  I know it was on J7 OCP.  

I have two issues with this question and the related answer:
The question states "MyTask extends ForkJoinTask" then in the possible answers:

B. MyTask inherits RecursiveAction.
C. MyTask inherits RecursiveTask.

And in the answers it is said that C is correct.  But C is not correct. Both RA and RT extend FJT. Just because MyTask extends FJT does not mean it inherits either RA or RT. It's just another subclass of FJT, as are RA and RT.
In looking at the documentation I see that compute is defined in RA and RT but fork and join are defined in FJT. You can submit a FJT to a ForkJoinPool but you can't then call compute on a FJT although you can call fork and join.

Also in the question, D is said to be incorrect:

D. The code produces a ForkJoinPool at runtime.

Why is this? In the code there is the line:

ForkJoinPool pool = new ForkJoinPool(1);

which obviously creates a new FJP.

I am confused by both these issues; I am fairly certain of my read of it but am happy to be corrected.