File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in K&B SCJP 6: topic Sorting with the Arrays Class

 
Gabriel Moreno
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On top of page 576 of K&B SCJP 6 it says that the Arrays.sort() method is overriden in the same way Collections.sort() method is.

What? Arrays and Collections extend from Object class. Object class doesn't have a sort() method, so... Where is the override? Which method did Arrays.sort() or Collections.sort() overrode? I just don't see how those two methods are overriden in any way. What am I missing here?

My guess is that is a edition mistake, please any comment on the topic would be greatly appreciated. I have been pondering this for days.
 
M Srilatha
Ranch Hand
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I guess it should be:
"the Arrays.sort() method is overloaded in the same way Collections.sort() method is."

I donot have SCJP6 book.But in SCJP 5, after this stmt two forms of sort method are given. So i think it should be overloaded instead of overridden.
 
Gabriel Moreno
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is not overloaded because right after the two forms of sort() being given it says:

In addition, the Arrays.sort() method is overloaded about a million times to provide a couple of sort methods for every type of primitive.

So, it doesn't make any sense to have overloaded as a statement first and then say "in addition is overloaded"
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic