Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using compareTo() in string

 
Pratik D mehta
Ranch Hand
Posts: 121
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 .
 
Gary Ba
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try removing the ; from line 9. And see what happens

Gary
 
Pratik D mehta
Ranch Hand
Posts: 121
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you gary .
I invested about 2 hours on this simple thing .
Its was so silly of me.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your source code really formatted like that?
 
Gary Ba
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic