Win a copy of Rust Web Development this week in the Other Languages forum!

Daniel Hernaez

Greenhorn
+ Follow
since Feb 15, 2010
Spain
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daniel Hernaez

I just talked to an Oracle worker and told me that is perfectly right to make only one course for two different certifications.

See you.
Thank you very much for the advises. I will ask to Oracle for the posibility of doing only one course for two different certifications because this can save a lot of money. I will let you know.

See you.
Hello guys, I am going to prepare OCMJD certification and I am not sure about what mandatory course should I take.

My first two options are:

Developing Applications With the Java SE 6 Platform
Java SE 7: Develop Rich Client Applications

Base on your experience and the certification requirements, what course do you think is the most useful?


Thank you very much.


And the output would be:

a b c d e
a b c d e
e d c b a



This is a simple example but I think it demonstrates that you can't say it's easier to traversal a PriorityQueue than a LinkedList.


Thanks.
This is one answer of question 20, Practice Exam 1 (Programmer Practice Exams book)

"It’s programmatically easier to perform a non-destructive traversal of a PriorityQueue than a LinkedList."

Can anybody explain why this is true? I checked the API and I can't see any special methods in PriorityQueue not present in LinkedList to traversal both collections.


Thanks in advance.
This is question #52 from K&B Java 6 quiz A



The question is: which of the following will fulfill the equals() and hashCode() contracts for this class?

And correct answers are:
C) return (((SortOf) o).code.length() * ((SortOf) o).bal == this.code.length() * this.bal);
D) return (((SortOf) o).code.length() * ((SortOf) o).bal * ((SortOf) o).rate ==
this.code.length() * this.bal * this.rate);


I can't see why D) is a correct answer. If I try this:


I actually have 2 'equals()' objects in the Set collection. Also, if you read the hashCode() contract, one of the points is:
- if x.equals(y) == true then x.hashCode() == y.hashCode()

and here, with D) declaration of equals(), I have 2 equals() objects with different hashCode()

sortOf1
- equals(): 4 * 3 * 5 = 60
- hashCode(): 12

sortOf2
- equals(): 4 * 5 * 3 = 60
- hashCode(): 4 * 5 = 20


Can you give me a hand?

Thanks in advance.
Thanks a lot, I didn't realise of that.

See you.
Hello to everybody, I am studying for my SCJP exam and this is my first post. Thanks in advance for your help.

My doubt refers to question #1 of chapter 3 self test (page 277).



The question is: When // doStuff is reached, how many objects are elegible for GC?

The correct answer is C. 2 objects are elegible for GC: c1 and its associated Short wrapper object.


Now, if I debug that code with Eclipse, I see that c3 object is also null due c1.go(c2) returns null. So, why isn't c3 also eligible for GC?


Thank you.