• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to reverse the input string

 
Phil Maqui
Greenhorn
Posts: 10
Chrome Eclipse IDE Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried finding stuff on the net on how to do this, but all in vain, can anyone help me on this?
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although a StringBuilder should be preferred over a StringBuffer unless you need the synchronization, that will work. It will not be a valid answer to any homework assignment though.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Phil Maqui wrote:i tried finding stuff on the net on how to do this, but all in vain, . . .
Just as well you didn’ find anything. As you will see here,
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
. . . you are better off working it out for yrruself.

To work it out for yourself, you need some very high-technology with curvilinear frictional recolorisation, two-dimensional illuminative inspection capabilities, and polymeric deletion. That means: pencil, paper and eraser The last-named is probably the most important.
Write down what you think you want to do to reverse the String. Hint: go through the String class, and you will find methods which can supply you with the information you need from the String. Once you have it written down, and got it into words of one syllable, then you have it in a form the computer can understand, and which you can convert to code.
 
Harsha Smith
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unsual way of reversing a string

String s = "why don’t you read the previous posts so you know not to give a whole answer?";
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the previous posts, then you will see why you ought not to have posted the solution. I have pulled rank and deleted it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic