title: Reversing a sentence recursively in Java
body: <p>I want to reverse a sentence recursively and below is my following code. I wanted to know what other bases cases shud i take care of. And for the base case if string is null, how should that be handled?</p>
  
  <pre><code>public String reverse(String s) {
  int n = s.indexOf(' ');
  if(n == -1)
      return s;
  return reverse(s.substring(n+1))+" "+s.substring(0,n);
  
  }  
  </code></pre>