I want to change the first method to a while and for loop. I have added the code below. Is this correct?
public String extractWordFour(String text){
        if(text.length()==0 || text.charAt(0) == ''){
            return "";
        } else {
            return text.charAt(0) + extractWordFour(text.substring(1));
        }
    }
public String extractWordFour(String text){
    int i=0;
    while (i<=text.length){
        return text.charAt(0) + extractWordFour(text.substring(i));
        i++;
    }
}
public String extractWordFour(String text){
    for(int i=0;i<=text.length();i++){
        return text.charAt(0) + text.substring(1);
    }
}