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
Look at the color key below the map that shows the overall performance range. What is the range for 1 Year Performance? How does
swat32

A performance range simply means the threshold and maximum percentage of shares that may become earned.

<h3>What is a performance range?</h3>

Your information is incomplete. Therefore, an overview will be given. A performance range is the maximum percentage if shares that may become earned shares due to the attainment of the requirements of the performance.

It should be noted that in this case, the opportunity to incentivize performance will be associated with the relative performance.

Learn more about performance on:

brainly.com/question/26256535

5 0
2 years ago
3 advantages of using desktop computer rather than a laptop computer
Vilka [71]
Desktop can be customized and it usually has more processing power than laptops, as for laptops are better for portable work like word document
6 0
3 years ago
Read 2 more answers
7. Glaciers have two types of deposition. Define them below:
Zielflug [23.3K]
<span>The Glacial deposition is the settling of sediments left behind by a moving glacier. As glaciers move over the land, they pick up sediments and rocks. The mixture of unsorted sediment deposits carried by the glacier is called glacial till. Piles of till deposited along the edges of past glaciers are called moraines.</span>
5 0
4 years ago
All modern cd-r drives are _______________, such that you can go back and burn additional data onto the cd-r disc until the disc
ratelena [41]
All modern cd-r drives are writable, such that you can go back and burn additional data onto the cd-r disc until the disc is full.
6 0
4 years ago
This lesson introduced the notion of "efficiency" in programming, and that it might mean different things at different times. Th
Morgarella [4.7K]

Answer:

<u>In physics</u>, efficiency is a measure of how much energy is conserved in a process.

<u>In programming</u>, efficiency is directly linked with the speed of runtime execution for software and algorithmic efficiency.

In this comparison, both meanings try to measure the quality of the processes and have formulas to detect this efficiency.

Both meanings have different formulas to define the measures, Big O notation for programming and percentage of energy output divided by energy input for physics. Furthermore, in physics is not possible to get 100% efficiency, but it is possible for programming to have O(1) of efficiency.

4 0
3 years ago
Other questions:
  • A restaurant is a workplace for someone whose career specialty is in
    14·2 answers
  • If your BAL is .10 you can expect a _______ drop in complex performance compared to the sober level
    6·1 answer
  • Write the function mystrchr(). the function has two parameters: a const char * s pointing to the first character in a c-style st
    14·1 answer
  • Does Windows 7 support secure boot in UEFI? Windows eight? Linux UBUNTU version 14?
    8·1 answer
  • Complete the function void update (int *a, int *b), which reads two integers as argument, and sets a with the sum of them, and b
    8·1 answer
  • To implement a small database, a database designer must know the "1" and the "M" sides of each relationship and whether the rela
    7·1 answer
  • When installing EMT conduit that will be exposed to wet conditions, _______ fittings should be used.
    5·2 answers
  • What would happen if your computer was infected with the virus or if your network went down?
    10·2 answers
  • Need answer ASAP. I’ll mark brainliest if correct
    7·1 answer
  • Polynomial regression A common misconception is that linear regression can only be used to fit a linear relationship. We can fit
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!