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.
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