This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes RE:reversing a string program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "RE:reversing a string program" Watch "RE:reversing a string program" New topic
Author

RE:reversing a string program

Vidya Bhargavi
Greenhorn

Joined: Jul 09, 2009
Posts: 26
Hi,


input:"welcome to cornet"
output:"emoclew ot tenroc"


Can anyone please write a program with the above specified input to get the desired output.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19326
    
  41

Vidya Bhargavi wrote:Can anyone please write a program with the above specified input to get the desired output.


What have you tried? And what issues have you run into? ... and you should read this...

http://faq.javaranch.com/java/NotACodeMill

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Miklos Szeles
Ranch Hand

Joined: Oct 21, 2008
Posts: 142
Yes, we can. And you can too;) We can help if you stucked somewhere but we won't write theprogram instead of you. So I advice you to try to do it yourself and come back some code what you wrote when you stucked.
Vidya Bhargavi
Greenhorn

Joined: Jul 09, 2009
Posts: 26
Hi,



i tried reverse method in stringbuffer class.....

but i am able to reverse the input as a whole sentence only....

i need that to be done word by word as specified above....

please give me the logic for that
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19905
    
  23

Can you find the word boundaries? If so, you can use those to reverse only parts of the String.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Vikash Ananda
Ranch Hand

Joined: Oct 12, 2009
Posts: 32
First Help:

Do some Homework

Second Help:

1. use loops
2. see for documentations
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RE:reversing a string program