File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

String Reversing With code

Prasad Chelur

Joined: Feb 12, 2002
Posts: 10
public class preparestr{
String s="Hello world";

public void reversing(){
int i=s.length();
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();
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.

Jim Yingst

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
I agree. Here's the link:
subject: String Reversing With code
It's not a secret anymore!