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]
3 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]3 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
The Internet is considered a WAN. *<br><br> True<br> False
nlexa [21]

Answer:

true-ish

Explanation:

WAN= wide area network

LAN= local area network

it could be considered a wide area network, but not necessarily. The internet is it's own type of connection, so I'm not quite sure if it would be considered something else or WAN.

4 0
3 years ago
What is A/B Testing
Gnom [1K]
A/b testing is comparing two versions of a web page to see which one performs better
8 0
3 years ago
Read 2 more answers
Choose the term that matches the action.
AveGali [126]

Answer:

i guess patent thief might be the answer

5 0
3 years ago
Read 2 more answers
IN EXCEL, File, menu , edit, insert are all located in ?
abruzzese [7]

Answer:

menu bar is the correct answer

hope it helps☺️

7 0
3 years ago
9.18 lab: even/odd values in a vector write a program that reads a list of integers, and outputs whether the list contains all e
lana66690 [7]

def is_list_even(my_list):

   for i in my_list:

       if(i%2 != 0):

           return False

   

   return True

   

   

def is_list_odd(my_list):

   for i in my_list:

       if(i%2 == 0):

           return False

   

   return True

   

def main():

   n = int(input())

   lst = []

   

   for i in range(n):

       lst.append(int(input()))

   

   if(is_list_even(lst)):

       print('all even')

   

   elif(is_list_odd(lst)):

       print('all odd')

   

   else:

       print('not even or odd')

       

       

if __name__ == '__main__':

   main()

6 0
2 years ago
Other questions:
  • Attention merchants define
    5·1 answer
  • _______ computing refers to applications and services that run on a distributed network using virtualized resources.
    14·1 answer
  • Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co
    6·1 answer
  • You would like to conduct a survey and ask your web page visitors to indicate the computer operating systems that they use. Each
    10·1 answer
  • A communications objective is:
    12·1 answer
  • Whic flag has a special role in debuging
    6·1 answer
  • Help me find the difference between these logos
    10·2 answers
  • What is the difference between the flip horizontal and the flip vertical option
    8·1 answer
  • 3.6 Code Practice Edhesive. (PYTHON LANGUAGE)
    13·1 answer
  • Describe the specific job you would want to have if you were going to pursue a career in digital music or video.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!