aspose file tools*
The moose likes Beginning Java and the fly likes String return form method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String return form method" Watch "String return form method" New topic
Author

String return form method

Sami Devine
Ranch Hand

Joined: Jan 30, 2011
Posts: 44

Reversed string is 2 = SamiimaS (as expected)
Reversed string is 1 = Sami (Shouldn't this be the same as above?)
Roger Fed
Ranch Hand

Joined: Oct 17, 2010
Posts: 82

You should use code tags to help us helping you
http://www.coderanch.com/how-to/java/UseCodeTags


I Hear I Forget, I See I Remember, I Do I Understand.
Sami Devine
Ranch Hand

Joined: Jan 30, 2011
Posts: 44
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

Joined: Sep 08, 2007
Posts: 3071
    
  33

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'.


Mohamed Sanaulla | My Blog
Sami Devine
Ranch Hand

Joined: Jan 30, 2011
Posts: 44
Thank you.

Sami Devine
Ranch Hand

Joined: Jan 30, 2011
Posts: 44
Thank you Campbell. Your link was very informative.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
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

Joined: Jan 30, 2011
Posts: 44
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

Joined: Oct 27, 2005
Posts: 19696
    
  20

That link is automatically created by the forum software.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String return form method