Answer to Question #255524 in Java | JSP | JSF for Tege

Question #255524

Write the java Program to reverse the letters present in the given string.


1
Expert's answer
2021-10-24T20:19:32-0400
public class Main {
    public static void main(String[] args) {
        String data = "Test string";
        char[] tmp = new char[data.length()];
        for (int i = data.length() - 1, j = 0; i >= 0; i--, j++) {
            tmp[j] = data.charAt(i);
        }
        System.out.println(new String(tmp));
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS