a block 4 kg hang freely by a string For each of the following calls, indicate t
ID: 3811534 • Letter: A
Question
a block 4 kg hang freely by a string For each of the following calls, indicate the output that is produced by the method a. mystery XY (4, 1); b. mystery XY (4, 2); c. mystery XY (8, 2); d. mystery XY (4, 3) e. mystery XY (3, 4) Convert the following iterative method into a recursive method://Prints each character of the string reversed twice.//doubleReverse ("hello") prints oolllleehh public static void doubleReverse (String s) {for (int i = s.length() - 1; i >= 0; i--) {System.out.print (s.charAt (i)); System.out.print (s.charAt (i));}}Explanation / Answer
public class DoubleRecursive{
public void doubleRecursive(String s) {
int i
if(i>0){
i--;
System.out.println(s.chart(i));
System.out.println(s.chart(i));
doubleRecursive(i);
}
}
public static void main(String[] args){
DoubleRecursive r= new DoubleRecursive();
r.doubleRecursive(s.length()-1);
}
}
I hope it help you .
Thanks
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.