Recursive Boolean Method Output
What is the output when the above program is executed?
public class Main {
public static boolean isPowerOfTwo(int n) {
if(n < 1)
return false;
if(n == 1)
return true;
if(n % 2 != 0)
return false;
return isPowerOfTwo(n / 2);
}
public static void main(String[] args) {
System.out.println(isPowerOfTwo(32));
}
}
A
‘32’
B
false
C
true
D
null
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE