Tim Holmes

+ Follow
since Aug 26, 2005
Merit badge: grant badges
For More
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 Tim Holmes

How do you avoid the call in "test mode"?
12 years ago
Um I don't think you understood the question. I am not trying to inject anything. I am trying to mock DOMParser. This is just an example.
12 years ago
Hey guys,

I am using JMock and my class under test calls certain other classes. The classes that are called are not injected into my class under test. I know how to inject mocked objects with a setter, but what do I do for classes under test that call other classes and my class doesn't have a setter to inject that mocked object?

12 years ago
I guess I forgot to mention that I did a lot of coding, referring to notes and looking at Java Docs. Honestly, it helped me more to just see their answer specifically on the ones where it was more complex and there was not a quick API type reference answer.

As far as being brave...because of when I signed up I had a free retake (which I didn't have to use).

I did the Java 5 Exam.
That helps a lot!

Okay, I looked in the FAQs and searched posts and don't see this answered. How is this exam compared to the SCJP? Thanks!
Preparation: Read through the K&B book taking notes. Then I went through the Whizlabs tests (I think there are 8). After I got through about half of them what I did was submitted the whole exam without answering a question. Then i went through and tried to answer the question without looking at the answer and then reviewed it immediately. This helped me a lot. One thing I didnt' like about Whizlabs was that you do 60 some questions and have to remember what you were thinking on each one in review. I found this hard. I also went through some of the short custom tests.

On Whizlabs, like I said, I scored usually just below passing. On the actual exam I scored a 68%. As an aside on Whizlabs in threading a I did great and usually got them right. On the actual exam I scored the lowest in that area.
Well, I passed the exam on Friday!!! Wooo whoo! But I wanted to make a post here regarding Whizlabs, so that others who are in the same boat might not be discouraged. I used Whizlabs and took a lot of their practice tests. I think I only passed 2 times when taking those and when I passed it was just barely. Most of the time I failed by 5-10 percentage points. I thought I would let everyone know so others are not discouraged if they're using Whizlabs.

I am trying to figure out why this would be legal as a override:
void method(int i, float f){}

but this would not:
protected void method(int i, float f){}

wouldn't they be the same except the first one is "default access"?
I am trying to understand the order that certain things are constructed in a object when you create it. I am getting tripped up on little questions that include when certain parts of the construction happen. Could someone help me with outlining the order of object construction? Here is what I understand:

1. Static blocks run
2. Constructor is called
3. No arg call to super is inserted, unless there is another call to super (with the same or other arguments)
4. Class variables are initialized
Ah that makes sense...thanks!
That makes sense (casting int to a float). Thanks.
Why does f equal 2.0 here instead of 2.6?

I am trying to undestand what is going on here:

I know that it is starting at index 10 and figured out that is zero based so it is starting at the "n" of the second "One". Then it counts backwards to find the the last occurrence of "One". The example I am looking at says it is "9", but if i count backwards like when finding the starting index, the "n" of the second "One" is zero and 9 is the "n" of the first "One". Right?
Please see my code below. Here is my question...in Example A the code is sharing a copy of the MyRunnable class so it is sharing a variable "gear". I understand that. My question is on example B what is the point in synchronizing if the variable "gear" is not shared? Both threads are gauranteed to access the "gear" variable independently! In addition, can a run method on a class that extends thread ever be called by more than one thread? If so how?

Example A:

Example B: