Question: 5/ (Recursive methods] (20 points) 5.1/ Given the following recursive method: public static String myMethod1(String str) if (str.length) 0) return str if (str.charAt(0) 'x') return

 5/ (Recursive methods] (20 points) 5.1/ Given the following recursive method:

5/ (Recursive methods] (20 points) 5.1/ Given the following recursive method: public static String myMethod1(String str) if (str.length) 0) return str if (str.charAt(0) 'x') return myMethod 1 (str.substring(1)); return str.charAt(0)+ myMethod1(str.substring(1)): What does myMethod1("axbbxx") retrn? Your answer:. Explain your answer by showing what the method does, step by step, for myMethod1("axbbxx. Your answer: 5.2/ Given the following recursive method: public static int myMethod2(int num) i if (num-:0) return 0; if (num % 2 .. 0) return 1 + myMethod2(num/2); return myMethod2(num/2); What does myMethod2(54) return? Your answe:. Explain your answer by showing what the method does, step by step, for myMethod2(54). Your

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!