1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OlgaM077 [116]
4 years ago
6

Write a recursive method public static String reverse(String str) that computes the reverse of a string. For example, reverse("f

low") should return "wolf". Hint: Reverse the substring starting at the second character, then add the first character at the end. For example, to reverse "flow", first reverse "low" to "wol", then add the "f" at the end.
Computers and Technology
1 answer:
Aneli [31]4 years ago
5 0

Answer:

Explanation:

StringRecursiveReversal.java

public class StringRecursiveReversal {

   static String reverse1 = "";

   public static String reverse(String str){

       if(str.length() == 1){

           return str;

       } else {

           reverse1 += str.charAt(str.length()-1)

                   +reverse(str.substring(0,str.length()-1));

           return reverse1;

     }

   }

   public static void main(String a[]){

       StringRecursiveReversal srr = new StringRecursiveReversal();

       System.out.println("Result: "+srr.reverse("flow"));

   }

}

Output :

Result: wolf

You might be interested in
1. Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address
inna [77]

Answer:

It is paramount to notice that since we have word blocks and no address is separated then there are zero cache hits.Therefore the address sequence exhibits no temporal locality.

Check the attachment

8 0
3 years ago
What are the disadvantages of plasma display?
AleksandrR [38]
Hope this helps!

° Suspectible to phosphor burn-in

° Has shorter life span

° Has poor reproductions of the color black

° Not the highest resolution as seen in LCD

°Has a weird shimmering or flickering effect

° Uses more electrical power


4 0
3 years ago
Internet speed test, why does it take some time to get maximum speed
Brut [27]
Because speed test is measuring your real-time network connection, Tests taken within a few minutes of each other might vary a little based on network congestion and available bandwidth.
4 0
3 years ago
Create a string called alphabet containing 'abcdefghijklmnopqrstuvwxyz', then perform the following separate slice operations to
spin [16.1K]

Answer:

There is no short answer.

Explanation:

First let's create the string:

  • alphabetString = "abcdefghijklmnopqrstuvwxyz";

The first half of the string using slice method can be written as:

  • alphabetString.slice(0, 13);

The first half of the string using only the ending index can be written as:

  • alphabetString.slice(-13);

When we put - at the start of the index number, the counting begins at the last element with -1 and goes backwards.

The second half of the string can be written as:

  • alphabetString.slice(13,26);

The second half of the string using only the starting index can be written as:

  • alphabetString.slice(13);

To get the every second letter in the string, we need a for loop:

  • for( let x = 0; x < alphabetString.length(); x = x + 2){

                 alphabetString.slice(x);

}

To get the entire string in reverse, we can use the reverse method that is built-in:

  • alphabetString.reverse();

To get the every third letter of the string, we can again use a for loop:

  • for( let x = -1; x = -27; x = x - 3){

                  alphabetString.slice(x);

}

I hope this answer helps.

7 0
4 years ago
Why don't we get together to watch the Academy Awards?
Step2247 [10]

Answer:

idk I'm not sure cause yeah

5 0
3 years ago
Read 2 more answers
Other questions:
  • _ includes websites that encourage interaction and connection among people, businesses, and organizations. A. News sites B. Sear
    5·2 answers
  • Consolidating a system's physical and time resources is known as ________________.
    13·1 answer
  • Write code to simulate the following differential equation for x ranging from 0 to 5. Assume y = 0 when x = 0. Plot y vs. x usin
    11·1 answer
  • Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (excl
    11·1 answer
  • can Results shown at the top of the Google search engine results page (SERP) always get high Needs Met ratings
    10·1 answer
  • Under which menu option of a word processing program does a callout appear?
    7·2 answers
  • Serting a header at the top of a page will make it appear on_____. ?
    13·1 answer
  • Computing is the provision of IT services on demand.
    9·1 answer
  • How to do the for loop in python
    12·1 answer
  • Which is not and input device , keyboard , joystick, Monitor, Microphone​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!