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
Anti-lock braking systems can significantly.... a. impede your braking stability. B. improve your braking stability. C. improve
Setler79 [48]
Here is the answer that would best complete the given statement above. Anti-lock braking systems can significantly improve your braking stability. The correct answer would be therefore, option B. Anti-lock braking systems is for safety purposes in order for to prevent <span>the wheels from </span>locking<span> up (ceasing rotation) and avoiding uncontrolled skidding. Hope this answer helps.</span>
7 0
3 years ago
How do you get a code in C to count down from 5??
Valentin [98]

Answer:

This is what the code should do:

“Lift off in T minus

5

4

3

2

1

Blast-off!”

When I run it, it just keeps printing ''Sum = 5'' forever.

Explanation:

Code:

int main(void) {

int sum = 5;  

int i;      

printf("Lift off in T minus\n");

for (i = 0; i < 5; i=i+i) {

   sum = sum - i;  

   printf("sum = %d\n",sum);  

}  

printf("Blast-off",sum);  

return 0;

5 0
3 years ago
What is the function of ROM?
Gnoma [55]

Answer:

Hello, There!

<h2>Your Question↓</h2>

What is the function of ROM?

<h2>Answer↓</h2>

Allows parts of the computer to communicate is the Correct Answer.

Explanation:

<h2>Now you May Ask What does it do or How it works↓</h2>
  • ⇒ROM provides the necessary instructions for communication between various hardware components.
  • ⇒ it is essential for the storage and operation of the BIOS, but it can also be used for basic data management, to hold software for basic processes of utilities.

Tip: Wanna know how to earn points back for asking your Question?

If you do it's easy just when two people answer your question whichever answer you think is the best click the crown on the side to get 25% of your points back! :D

Therefore, I hope this helps!

6 0
2 years ago
To create a formula in______, you would first click in one of the cells​
Pavlova-9 [17]

Answer:excel

Explanation:

5 0
3 years ago
Read 2 more answers
. Write a code to define a linked list node using the above defined structure student (i.e. the data of the node is a student st
enyata [817]

Answer:

struct node{

   student data;

   node* next;

};

Explanation:

The above written is the segment of code is the structure of node of the linked list.The data of the node is type student.So the data of the node of the linked list will consist of the student details and the next is the pointer which holds the address of the next node.

8 0
3 years ago
Other questions:
  • Encrypt the message ENCRYPTION using a tabular transposition cipher with encryption keyword ONE. If necessary, pad the message w
    7·1 answer
  • Whats the difference between copying a file to my desktop and creating a shortcut?
    8·1 answer
  • Do you think that people have a “right” to remain anonymous online? Why or why not?
    6·1 answer
  • A process that rearranges the data and objects in a database to decrease its file size, thereby making more space available on y
    11·1 answer
  • Could someone please explain to me the an electrical circuit.
    13·2 answers
  • Unlike radio frequency identification (RFID) tags, bar codes: Question 30 options: require a reader that tunes into a specific f
    14·1 answer
  • When LDAP traffic is made secure by using Secure Sockets Layer (SSL) or Transport Layer Security (TLS), what is this process cal
    9·1 answer
  • Write a statement that slices a substring out of the string quote and puts it into a variable named selection. If given the stri
    8·1 answer
  • How to connect apple pencil 2 to ipad 8th generation?
    11·1 answer
  • What is output?<br> x = 2<br> y = 3<br> print (x * y + 2)<br> 4<br> 2<br> 8<br> 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!