Hi Lucky,
Option
A is incorrect since there is no a.reverse() method.
Option
D also is incorrect since there is no Collections.reverseOrder(
Arraylist a) method.
Option
E is incorrect there is no class or interface called InverseComparator and also Comparator class is an abstract class which cannot be instantiated.
Can anybody help me explaning ,
difference between answer B and C
The above code compiles fine , but gives a vague result which cannot be guaranteed.In this case sometimes would be values such as -9,-10 etc.
This code compiles fine and gives the result 2.
You could also have a look at the two binarySearch methods of Collections class in
Java API which tells in detail about the differences of the 2 methods.
I hope this helps you.
Thank you
Meera
[ September 24, 2007: Message edited by: Meera Nanda ]
[ September 24, 2007: Message edited by: Meera Nanda ]