aspose file tools*
The moose likes Beginning Java and the fly likes using compareTo() in string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using compareTo() in string" Watch "using compareTo() in string" New topic
Author

using compareTo() in string

Pratik D mehta
Ranch Hand

Joined: Jul 29, 2010
Posts: 121


I am getting answer as
sat
rat
are
zap
xem
But it is expected that we should get this
are
rat
sat
xem
zap
This question is very simple but , I dont get the flaw .


Understanding is Everything - Peter Lord
Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 161

Try removing the ; from line 9. And see what happens

Gary


star chaser..
Pratik D mehta
Ranch Hand

Joined: Jul 29, 2010
Posts: 121

Thank you gary .
I invested about 2 hours on this simple thing .
Its was so silly of me.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is your source code really formatted like that?
Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 161

Thank you gary .
I invested about 2 hours on this simple thing .
Its was so silly of me.


We've all been there. Sometimes we stare at code for too long that we miss the actual problem. A second eye would not hurt either.
Glad I softened the head banging.

Gary
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using compareTo() in string