Write a method called reverse that accepts a String parameter and returns a string that contains the characters of the parameter in reverse order. Note that there is a method in the String class that performs this operation, but for the sake of this exercise, you are expected to write your own.
What will be an ideal response?
```
public String reverse(String text)
{
String result = "";
for (int place = text.length()-1; place >= 0; place--)
result += text.charAt(place);
return result;
}
```
You might also like to view...
What is the difference between a while and a do…while loop?
a) The condition of a while is evaluated at the start of the loop; the condition of the do…while is evaluated at the end. b) The body of a do…while loop is always executed once; the body of a while loop may never be executed. c) Both a and b d) There is no difference.
Which of these statements concerning the systems development life cycle is true?
A) Designing the system is the first step in the SDLC. B) No phase can occur until the previous phase is completed. C) Although each phase is presented discretely, it is never accomplished as a separate step. D) There is widespread agreement that the SDLC is composed of seven phases.
Which of the following organizations is not considered part of the global information assurance (IA) industry experts?
A. SANS Institute B. (ISC)2 C. EC-Council D. CompTIA
You open a folder Properties box to encrypt the folder, click Advanced, and discover that Encrypt contents to secure data is dimmed. What is the most likely problem?
a. Encryption has not been enabled. Use the Computer Management console to enable it. b. You are not using an edition of Windows that supports encryption. c. Most likely a virus has attacked the system and is disabling encryption. d. Encryption applies only to files, not folders.