Recursive String Method Output
Consider the following RemoveVowels class. What is printed when the program is executed?
public class RemoveVowels {
public static String remove(String s) {
if(s.length() == 0) return "";
if("AEIOUaeiou".indexOf(s.charAt(0)) != -1)
return remove(s.substring(1));
return s.charAt(0) + remove(s.substring(1));
}
public static void main(String[] args) {
System.out.println(remove("Hello"));
}
}
A
hll
B
Hll
C
Hello
D
Heo
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE