This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt in K&B SCJP 5: topic binarySearch() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt in K&B SCJP 5: topic binarySearch()" Watch "Doubt in K&B SCJP 5: topic binarySearch()" New topic
Author

Doubt in K&B SCJP 5: topic binarySearch()

Franz Fountain
Ranch Hand

Joined: Nov 15, 2006
Posts: 58
K&B p. 557 4th bullet
"which is passed as the second argument to the binarySearch() method."
s/b
"which is passed as the third argument to the binarySearch() method."

In other words the Comparator is the 3rd argument to binarySearch() not the 2nd. See example on same page at "#5".
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
Right Franz,
In binarySearch()method the first argument is for the array in which search to be made,the second is the key which is to be searched and third(optional) is for the comparator.


~Sanjeev Singh<br />SCJP 1.5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in K&B SCJP 5: topic binarySearch()
 
Similar Threads
Java Comparators
Passed SCJP 5 91%
passed it
binarySearch() : Help Needed
Passed It