Claire Radford

Greenhorn
+ Follow
since Nov 02, 2000
Merit badge: grant badges
For More
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 Claire Radford

Can someone explain how come a SortedSet is sorted and not ordered? It seems counter inutitive that something should be sorted and not ordered to me (as sorted means that elements are comparatively put in order does it not? If the elements are sorted how can this be helpful if the set is not ordered? Also which Collections are ordered and which are sorted?
I think the answer is -you have some static code within the class Q8, which is run when the class is loaded. However, the variable i inside this static block is local to this block and hence goes out of scope after the code block ends. It does not affect class variable i.
Yes you could, but I think the point is that if someone tries to use a method which is not supported (ie if you want your class not to support method add) then an exception will be thrown to show this.
Sorry, I think I have figured this out. I presume if you don't want to implement the function you make it throw an UnSupportedOperationException in your code. Is that correct?
I was under the impression (and I'm pretty sure it's right) that when implementing an interface you had to provide an implementation of all its methods (unless the class is abstract) However, while looking at the specification for the Collection interface it says that the method add(Object o) is an "optional operation". Can someone tell me what this means?