Given the following method: public void mystery(int n) { if(n == 0) System.out.p
ID: 3608646 • Letter: G
Question
Given the following method: public void mystery(int n) { if(n == 0) System.out.print("*"); else { mystery(n - 1); System.out.print("+"); mystery(n - 1); } } What is returned by the method call: a)mystery(0)________ b)mystery(1)________ c)mystery(2)________ Given the following method: public void mystery(int n) { if(n == 0) System.out.print("*"); else { mystery(n - 1); System.out.print("+"); mystery(n - 1); } } What is returned by the method call: a)mystery(0)________ b)mystery(1)________ c)mystery(2)________Explanation / Answer
output will be a) * mystery(0)=* b) *+* mystery(1) =mystery(0)+mystery(0) =*+* c) *+*+*+* mystery(2) =mystery(1)+mystery(1) =*+*+*+*
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.