Myke Enriq

Ranch Hand
+ Follow
since Feb 13, 2012
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 Myke Enriq

As I am to understand from that book in the following code:

In main() - the main thread, I start a new thread t. What happens if the processor/operating system is too busy and t is not started immediately ? t goes into READY state, and my main thread calls t.sleep(1000);

As t.sleep() cannot happen (since t is in READY but not RUNNING state), what will happen with my main thread ? Will it block till t.sleep(1000) runs ? What it t is a low priority thread and it takes a while for it to start then to sleep () ?

Correct me if I am wrong, the book is unclear about this.
I am not sure of what exceptions classes must I learn for the exam. Could someone please point me to a list ?

Joanne Neal wrote:Suppressed exceptions are only added automatically in a try with resources statement.
If you want suppressed resources to be added in any other situation you need to do it yourself.

Thank you all for your replies. I have read the tutorial , yet it is a bit unclear to me how do suppressed exceptions get automatically added.

Could someone please provide an example of an auto generated/added suppressed exception ?
What exactly does this method return ? It actually returns a Throwable[].

The code above prints: e.getSuppressed().length = 0 , but should getSuppressed not contain ArrayIndexOutOfBoundsException and print 1 ?
What classes & interfaces must I memorize the methods of, for the OCP exam ? I am having trouble figuring out how much must I know about LinkedBlockingQueue for example.

Is there anywhere a list of what classes must I take a look at ?
Must I read their source code, or were they just an example of the factory pattern in G&T's book ?

Tim Cooke wrote:Far too generic. We'll end up with a huge single topic with multiple refactoring discussions in it. How would that be useful? How would you search it? How would we talk about it? "Oh that particular refactoring was discussed in the 'Refactoring' topic on page 74". It's just not manageable at all. It's akin to saying "Shouldn't we put all our code in main? It's all just code after all right?"

I agree that discussing refactoring is a valuable thing to do but we should do it one problem at a time, one topic at a time.

I like the way you think, and indeed this has the potential to turn into an epic thread. Would it not be better though if all refactoring discussions happen in a single thread just like you described ? I mean, a novice programmer could just browse through conveniently because it is all in one place.
Shouldn't we have a topic only for refactoring ?

This could be useful as it will improve a lot of people's coding style.
Thank you for your replies. I feel these exercises may prove useful both for me and others. Here is another piece of code:

This is from a function that has multiple similar blocks of code like this one, one after another. Basically an object has many fields, and I need to set each of those values from an array of String.

Could I write this easier to read/more elegant ?

Any ideas on how to improve this code's readability ?
I am glad that you did not hurry and made the right choice. In the end the goal is to learn as much Java as possible, not a diploma.

As for last week advice, I am not qualified to give any, as at the moment I am studying myself for this exam.
Having said that, one good thing that I did for the OCA exam was to solve the enthuware mock exams in the week before the exam, so that I remembered the questions and answers.
Plus I had read the SCJP 6 K&B book twice before I took the exam.

Could you please tell us what books have you used to study for OCP ?