Analyze the following recursive method and indicate which of the following will be true.
public static long factorial (int n)
{ return n * factorial (n - 1); }
a) The method runs infinitely and causes a StackOverflowError.
b) Invoking factorial (2) returns 2.
c) Invoking factorial (1) returns 1.
d) Invoking factorial (0) returns 0.
+5
Answers (1)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Analyze the following recursive method and indicate which of the following will be true. public static long factorial (int n) { return n * ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Home » Computers & Technology » Analyze the following recursive method and indicate which of the following will be true. public static long factorial (int n) { return n * factorial (n - 1); } a) The method runs infinitely and causes a StackOverflowError.