Q:

Write a java method that reverses a string

0

Write a method that reverses a string.
For example, java interview becomes weivretni avaj.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

public String reverse(String s) {
String result = "";
for (int i = 0; i < s.length(); i++) {
    result += s.charAt(s.length() - i - 1);
}
return result;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now