Joel Arnold

Greenhorn
+ Follow
since Jun 21, 2006
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joel Arnold

I've been studying on it part-time for about three months, I prepared this way :

- Read the K&B book and did the self-tests.
- Took the Master exam -> 65 %
- Read the book again, did the self-tests again.
- Practiced on this site (paid to access all the questions) : http://www.examulator.com/phezam/login.php
- Read Dave Allen's notes many times : http://holoquest.org/other/scjp5_webnotes.html
- Took the Master Exam again -> 85 %

And everyday I spent some time on the forums, and played the rules roundup quite often until I scored 100% all the time.

AND MOST IMPORTANTLY I coded many small examples to clarify any doubt that I had on any point either in the book or in the exams or in the prep notes.

Good luck !

--JA
[ August 07, 2006: Message edited by: Joel Arnold ]
14 years ago
Hi Javarancheros,

I passed the SCJP 5.0 with 91% this morning and I just wanted to thank you all, and especially the bartenders and ranch hands who spend so much time answering questions on this forum. It was really helpful.

Thanks !

Joel
14 years ago
Because with TreeSet or TreeMap, the elements are sorted, so for example :

LinkedHashSet<Integer> lhs = new LinkedHashSet<Integer>();
lhs.add(3);
lhs.add(2);
lhs.add(1);
for(int n : lhs) {
System.out.print(n + " ");
}

Will result in :
3 2 1

But :

TreeSet<Integer> ts = new TreeSet<Integer>();
ts.add(3);
ts.add(2);
ts.add(1);
for(int n : ts) {
System.out.print(n + " ");
}

Will result in :
1 2 3

The TreeSet and TreeMap keep the elements in SORTED order, not in ENTERED order.

Hope this helps,

Cheers,
--JA

Originally posted by Javier Sanchez Cerrillo:
Remember in Java you don't have multidimesional arrays, you have arrays of arrays.

int[][] a = {{1,2,}, {3,4}}; // This is just an array, and every of it's elements is an array. But is is just and array.

Object[][] o1 = a; // You are trying to assing an array of arrays to an array. Different Types!!!

Object[]o1 = a; // You are trying to assing an array to an array. That's OK.



a IS an array of array...

Cheers!
--JA

Originally posted by saied ims:
class Dims {
public static void main(String[] args) {
int[][] a = {{1,2,}, {3,4}};

Object[][] o1 = a;//why this illegal?

but

Object[]o1 = a;//legal??
}
}



An int is not an Object, so you can't assign an array of array of ints to an array of array of Objects.

An array is an Object (Array extends Object), so you can assign an array of Arrays to an array of Objects.

Hope this is clear (too many arrays...)

Cheers !
--JA
I read that there is a rationale for this seemingly inconsistant behavior, it is made this way to allow programmers to have code that runs only while debugging :

for example with the use of a constant DEBUG that will be set to false in production code :

if (DEBUG)
System.out.println("I wouldn't wanna see that in production code...");

Hope this helps !

Cheers !

Joel
I couldn't get the bonus exam either, i don't know where in the site to get it, the explanations don't match with the osbourne site... :-(
I believe that when defining a generic type ( i.e between < and > ), the meaning of the "extends" keyword is "subclass or same class".

Likewise, in that context, the "super" keyword means "superclass or same class".
[ June 21, 2006: Message edited by: Joel Arnold ]