In the above code due to Autoboxing, by default Integer objects are added to tree, then why in the for each loop I cannot declare and use Integer reference variable . All I can use above is Object and NOT Integer.
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Omar Al Kababji
Joined: Jan 13, 2009
yes because you use TreeSet without any generics so it can take anything not only integers, if you want to use the TreeSet only for Integers then you have to do it like this
Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog