Recursive String Method Output
Consider the following recursive method. What is printed as a result of the call processString(input)?
public void processString(String input)
{
if (input.length() > 0)
{
System.out.print(input.substring(0, 1) + input.substring(0, 1));
processString(input.substring(1));
}
}
A
It prints input in reverse order, duplicating each character.
B
It removes every second character in input.
C
It duplicates each character in input.
D
It prints the first character of input twice.
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE