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
An effective team would never have​
MA_775_DIABLO [31]

Answer:

problems or struggles

Explanation:

i believe this because with an effective team most problems aren't there and you can understand and work out problems or struggles

4 0
3 years ago
How to delete the last element in array
svlad2 [7]

Answer:

Hey mate.....

Explanation:

This is ur answer.....

<em>To remove the last n elements from an array, use arr. splice(-n) (note the "p" in "splice"). The return value will be a new array containing the removed elements.</em>

<em />

Hope it helps!

Mark me brainliest pls.....

FOLLOW ME! :)

4 0
2 years ago
A(n) ________ is a chart based on PivotTable data.
Mrrafil [7]
Well since it’s a chart based on a PivotTable prettyyyy sure it’s gonna be a PibltChart
7 0
2 years ago
what is one example of the decomposers taking from the ecosystem and one of them giving to the ecosystem
adelina 88 [10]
Like when a seed drops on the ground, and a bee come to take some honey. It sticks to the bee and where the bee goes, the bee will rub it off and the seed will start to grow.
8 0
2 years ago
Ergonomia este știința care studiază ....
maria [59]

Answer:

Ergonomia (sau factorii umani) este disciplina științifică preocupată de înțelegerea interacțiunilor dintre om și alte elemente ale unui sistem și profesia care aplică teorie, principii, date și metode pentru a proiecta pentru a optimiza bunăstarea umană și în general performanta sistemului."

Explanation:

4 0
3 years ago
Other questions:
  • Write a program that inputs a line of text and uses a stack object to print the line reversed.
    14·1 answer
  • 3. Discuss the disadvantages of file-based systems.
    13·1 answer
  • For all those among our fans and SpongeBob fans which is better SpongeBob or amount us
    11·2 answers
  • A firewall is either software or dedicated hardware that exists between the __________ being protected.
    13·1 answer
  • Name the months that have 30 days​
    6·2 answers
  • Which type of error is a random error
    13·2 answers
  • A man-made world event that would affect the labor market would be a(n) _____.
    13·1 answer
  • It is believed that Taiwan is the original home of these early Oceania explorers. Maori Lapita Polynesians Aborigines
    13·2 answers
  • Which statement best describes the computers all around us?
    15·1 answer
  • Online platforms that allow users to represent themselves via a profile on a web site and provide and receive links to other net
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!