- The Following Recursive Method Called Z Is Created This Method Accepts Two Parameters A String S And An Integer Index 1 (25.94 KiB) Viewed 21 times
The following recursive method called z is created. This method accepts two parameters: A string s, and an integer index
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
The following recursive method called z is created. This method accepts two parameters: A string s, and an integer index
The following recursive method called z is created. This method accepts two parameters: A string s, and an integer index The code in the method is: <----- if (index -- s.length) return ""; base case if(index % 2 != 0) return ""+ s.charAt(index) + z(s, index+1); <-- recursive call else return z(s, index+1); <---- recursive call What would be the output with the call: system.out.println(z("javajavajava",0)); output: