Hello,
I am supposed to write recursive program. I have done this below, however I don't know if my understanding of recursion is correct. I believe that it is a method which calls this method inside. In my case (insertCommas).
private String insertCommas(String str)
{
if(str.length() < 4){
return str;
}
return insertCommas(str.substring(0, str.length() - 3)) + "," + str.substring(str.length() - 3, str.length());
}
Is my program recursive?
Thanks