Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Reverse a string in Java

I have "Hello World" kept in a String variable named hi.

I need to print it, but reversed.

How can I do this? I understand there is some kind of a function already built-in into Java that does that.

Related: Reverse each individual word of "Hello World" string with Java

Answer*

Draft saved
Draft discarded
Cancel
1
  • better to use StringBuilder/StringBuffer for the result variable to avoid multiple object creation! Commented Jul 30, 2022 at 17:18

lang-java

AltStyle によって変換されたページ (->オリジナル) /