Home Java Java-tips Data Strings Q-pr-string-using-loops Programming - reverse() method

Ask Questions?

View Latest Questions

Advertisement


 
 

Programming - reverse() method
Posted on: July 26, 2006 at 12:00 AM
Write a method which has one parameter, a string, which returns a string which is the parameter will all characters reversed.

Java: Programming - reverse() method

Problem

Write a method which has one parameter, a string, which returns a string which is the parameter will all characters reversed.

Details

Here is the details of the program to be written.

  • Method only. Write only the method, not main program.
  • No I/O. As usual, this method should do no I/O.
  • Method header. The method should be defined using this header.
    public static String reverse(String text)
  • Example.
    s = reverse("feed");
    This would assign "deef" to s.
Advertisement


DMCA.com