Intel Corporation Interview Question

Write a recursive Java function to reverse a String object

Interview Answer

Anonymous

Jul 18, 2015

public String reverse(){ if ( (str==null) || str.length()<=1) ){ return str; } return reverse(str.substring(1))+str.chatAt(0); }

6