• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to reverse the input string

 
Greenhorn
Posts: 10
Eclipse IDE Windows XP Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79177
377
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic