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
Alex73 [517]
2 years ago
8

Write method reverseString, which takes a string str and returns a new string with the characters in str in reverse order. For e

xample, reverseString("ABCDE") should return "EDCBA".
Complete the reverseString method below by assigning the reversed string to result.

/** Takes a string str and returns a new string

* with the characters reversed.

*/

public static String reverseString(String str)

{

String result = "";

return result;

}
Computers and Technology
1 answer:
son4ous [18]2 years ago
3 0

Answer:

The method written in Java is as follows:

public static String reverseString(String str){

    String result = "";

    int lentt = str.length();

    char[] strArray = str.toCharArray();

       for (int i = lentt - 1; i >= 0; i--)

           result+=strArray[i];

    return result;

}

Explanation:

This defines the method

public static String reverseString(String str){

This initializes the result of the reversed string to an empty string

    String result = "";

This calculates the length of the string

    int lentt = str.length();

This converts the string to a char array

    char[] strArray = str.toCharArray();

This iterates through the char array

       for (int i = lentt - 1; i >= 0; i--)

This gets the reversed string

           result+=strArray[i];

This returns the reversed string            

    return result;

}

<em>See attachment for full program that includes the main method</em>

Download txt
You might be interested in
Endnotes into a document are automatically positioned at the bottom of the page where the endnote reference is inserted.
dezoksy [38]
I think false hope its right
3 0
3 years ago
The benefits for a cad proram is: (points : 2) 1 accuracy 2 repeatability 3 simplicity 4 all of the above
NARA [144]
<span>ALL OF THE ABOVE. The benefits for a CAD program is accuracy, repeatability, simplicity.</span>
4 0
2 years ago
What underlying concept is edge computing based on?
guajiro [1.7K]

Answer:

Edge computing was developed due to the exponential growth of IoT devices, which connect to the internet for either receiving information from the cloud or delivering data back to the cloud. And many IoT devices generate enormous amounts of data during the course of their operations.

Explanation:

8 0
2 years ago
Read 2 more answers
PLEASE HELP ASAP!!!!!!!!!!!
Bingel [31]

Answer:

True

Explanation:

3 0
2 years ago
Read 2 more answers
What is an allocation unit?
sdas [7]
It is a unit of disk space allocation for files and directories. Hope this helps :) 
5 0
3 years ago
Other questions:
  • When it comes to saving money, what is a good rule of thumb?
    5·2 answers
  • Esther has acquired an associate's degree in information technology and certifications in PageMaker and Illustrator. Which caree
    8·2 answers
  • What will allow you to purchase software without receiving full rights to the program?
    14·1 answer
  • Given an array A of size N, and a number K. Task is to find out if it is possible to partition the array A into K contiguous sub
    9·1 answer
  • Where is a 3D modeler most likely to work?
    6·1 answer
  • public interface Displayable { void display(); } public class Picture implements Displayable { private int size; public void inc
    14·1 answer
  • Determine if the following statement is true or false:
    5·2 answers
  • Is there any quantum computer in India?​
    9·1 answer
  • What is a fire wall and how does it work
    14·1 answer
  • Which line of code will find the first occurrence of a three in an array?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!