This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String return form method

 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Reversed string is 2 = SamiimaS (as expected)
Reversed string is 1 = Sami (Shouldn't this be the same as above?)
 
Roger Fed
Ranch Hand
Posts: 82
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use code tags to help us helping you
http://www.coderanch.com/how-to/java/UseCodeTags
 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger,

I have removed portions of the code that were not needed for the question. I had already placed the code within code tags.

Also I have now placed my question in the code tag.

Please tell me if anything else needs to be done. Thanks
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to wrap the code around the CODE tags.

As Strings are immutable in Java- When you are trying to change the String- It actually creates a new one. And though your method reverse returns a String you are not assigning that to the variable 's'.
 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Campbell. Your link was very informative.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sami Devine wrote:Thank you Campbell. Your link was very informative.
My links are always informative . . . but I don't remember posting a link in this discussion
 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My links are always informative . . . but I don't remember posting a link in this discussion

I saw that you were the last to edit my first post. It has a new hyperlink. The String "string" is a hyperlink which leads to a previously posted question about String,Stringbuffer and Stringbuilder(I love this sentence). Your reply to that question was very informative.

So who added the hyperlink? But thank you anyway.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That link is automatically created by the forum software.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It must have been because I took the text out of code tags and the forum added the link to the class name “String”. Like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic