aspose file tools*
The moose likes Java in General and the fly likes String Reversing With code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

String Reversing With code

Prasad Chelur
Greenhorn

Joined: Feb 12, 2002
Posts: 10
import java.io.*;
public class preparestr{
String s="Hello world";

public void reversing(){
int i=s.length();
i=i-1;
for(int j=i; j>=0;j--)
{
System.out.println("The reversed string is"+s.charAt(j));
}
}

public static void main(String args[])
{
preparestr ps=new preparestr();
ps.reversing();
}
}
In the reversing fucn. i am pronting s.charAt().
I want to assign that value to my original string.
Please give me soln.
And also note the condition.
Don't use any Temprory variables,StringBuffer,Arrays.
Please
Reagrads
Prasad


prasadcts
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Perhaps you missed the responses the last time you asked. When you post a question, it's a good idea to read the answers. Also any other comments that might have been made about forum policies. If you have further questions on the same topic, post them as a response to the existing conversation, not as a new post - that way we can all see progress being made.


"I'm not back." - Bill Harding, Twister
 
wood burning stoves
 
subject: String Reversing With code