How to return a string from char[] array using recursion loop.(java)
- by Daniel
I am very bed in recursion...
I need to convert a char[] array by using recursion loop only, into string.
Without using for(),while()... loops. For example if i have char array: a[0]='H', a[1]='e', a[2]='l',a[3]= 'l',a[4]= 'o',
it returns H e l l o.
What I doing wrong?
public String toFormattedString(char[] a)
{
int temp =a.length;
…