The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

keep it simple here

Posted by terry on November 13, 2001 at 2:06 AM

keep it simple here
input.length() returns how many chars in string.

public String plainRecursion(String input) {
String output = new String();
if (input.length() > 0 ) {
output = input.charAt(input.length()-1) + plainRecursion(input.substring(0, input.length()-1));
}
return output;
}



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us