...

recursion in java

dw5304
03-24-2005, 06:19 PM
how would i take
public String reversal(String x){
int y = x.lenght();
String s =""
for(Int j=y-1;j>=0;j--)
s+=x.charAt(j);
return s;
}
and write a recursive function for it to do the same thing?

hinokata
03-25-2005, 12:57 AM
Before I help out on this one....please tell me you are not using this for real code. If your question is actually about recursion I'll be glad to help you out, if you are actually trying to append chars to a String like this(in reverse or normally) , I'll show you a MUCH better and more effecient way to do it.

dw5304
03-25-2005, 02:07 AM
i am not using this for code. I just practiceing for the ap computer science AB exam in four weeks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum