954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Reversing a String which is inputed.

I need help with this coding because I am having trouble with a lab of my class. I am up for any hints/tips and techniques... and code if desired. Well I am hoping that someone will respond and thanks.

pinoyboi619
Newbie Poster
1 post since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

Try this:

public class Reverse{
    public static void main(String [] arg) {
        String s = arg[0];
       
        for (int j = s.length()-1; j >= 0; j--) {
            System.out.print(s.charAt(j));
        }
    }
}
new_2_java
Junior Poster
127 posts since Apr 2007
Reputation Points: 7
Solved Threads: 6
 

A quick Google search will proved lots of information. Reversing a String is a very common classroom exercise.

jasimp
Senior Poster
3,623 posts since Aug 2007
Reputation Points: 533
Solved Threads: 53
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You