Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

String Reversing With code

 
Prasad Chelur
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic