You can use this:

new StringBuilder(hi).reverse().toString()

StringBuilder was added in Java 5. For versions prior to Java 5, the StringBuffer class can be used instead — it has the same API.

Answer from Daniel Brockman on Stack Overflow
🌐
W3Schools
w3schools.com › java › java_howto_reverse_string.asp
Java How To Reverse a String
Java Wrapper Classes Java Generics Java Annotations Java RegEx Java Threads Java Lambda Java Advanced Sorting ... How Tos Add Two Numbers Swap Two Variables Even or Odd Number Reverse a Number Positive or Negative Square Root Area of Rectangle Celsius to Fahrenheit Sum of Digits Check Armstrong Num Random Number Count Words Count Vowels in a String Remove Vowels Count Digits in a String Reverse a String Palindrome Check Check Anagram Convert String to Array Remove Whitespace Count Character Frequency Sum of Array Elements Find Array Average Sort an Array Find Smallest Element Find Largest Element Second Largest Array Min and Max Array Merge Two Arrays Remove Duplicates Find Duplicates Shuffle an Array Factorial of a Number Fibonacci Sequence Find GCD Check Prime Number ArrayList Loop HashMap Loop Loop Through an Enum
🌐
W3Schools
w3schools.com › Java › java_howto_reverse_string.asp
Java How To Reverse a String - W3Schools
Java Wrapper Classes Java Generics Java Annotations Java RegEx Java Threads Java Lambda Java Advanced Sorting ... How Tos Add Two Numbers Swap Two Variables Even or Odd Number Reverse a Number Positive or Negative Square Root Area of Rectangle Celsius to Fahrenheit Sum of Digits Check Armstrong Num Random Number Count Words Count Vowels in a String Remove Vowels Count Digits in a String Reverse a String Palindrome Check Check Anagram Convert String to Array Remove Whitespace Count Character Frequency Sum of Array Elements Find Array Average Sort an Array Find Smallest Element Find Largest Element Second Largest Array Min and Max Array Merge Two Arrays Remove Duplicates Find Duplicates Shuffle an Array Factorial of a Number Fibonacci Sequence Find GCD Check Prime Number ArrayList Loop HashMap Loop Loop Through an Enum
🌐
GeeksforGeeks
geeksforgeeks.org › java › reverse-a-string-in-java
Reverse a String in Java - GeeksforGeeks
We can use character array to reverse a string. Follow Steps mentioned below: First, convert String to character array by using the built-in Java String class method toCharArray().
Published   October 14, 2025
🌐
Sololearn
sololearn.com › en › Discuss › 2805778 › how-to-reverse-a-string-in-java
How to reverse a string in java | Sololearn: Learn to code for FREE!
If you prefer not to use an array and keep it simple with just Strings, then: String myWord = "abc"; String reversed = ""; for (int i = myWord.length() - 1; i >= 0; i--) reversed += myWord.charAt(i); System.out.println(reversed);
🌐
Javatpoint
javatpoint.com › how-to-reverse-string-in-java
How to Reverse String in Java - javatpoint
There are many ways to reverse String in Java. We can reverse String using StringBuffer, StringBuilder, iteration etc. Let's see the ways to reverse String in Java.
🌐
Simplilearn
simplilearn.com › home › resources › software development › how to reverse a string in java: 12 best methods
How to Reverse a String in Java: 12 Best Methods
May 5, 2025 - How to Reverse a String in Java? 1. Using toCharArray() 2. Using StringBuilder 3. Using While Loop/For Loop 4. Converting a String to Bytes 5. Using ArrayList
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
TutorialsPoint
tutorialspoint.com › home › javaexamples › java string reverse example
How to Reverse a String in Java
September 1, 2008 - Reversing a string is a common operation that can be done in multiple ways. Java provides both built-in methods and manual approaches to reverse a string. We can reverse a string using StringBuffer, StringBuilder, iteration, etc.
Find elsewhere
🌐
W3Schools
w3schools.com › java › java_strings.asp
Java Strings
Java Wrapper Classes Java Generics Java Annotations Java RegEx Java Threads Java Lambda Java Advanced Sorting ... How Tos Add Two Numbers Swap Two Variables Even or Odd Number Reverse a Number Positive or Negative Square Root Area of Rectangle Celsius to Fahrenheit Sum of Digits Check Armstrong Num Random Number Count Words Count Vowels in a String Remove Vowels Count Digits in a String Reverse a String Palindrome Check Check Anagram Convert String to Array Remove Whitespace Count Character Frequency Sum of Array Elements Find Array Average Sort an Array Find Smallest Element Find Largest Element Second Largest Array Min and Max Array Merge Two Arrays Remove Duplicates Find Duplicates Shuffle an Array Factorial of a Number Fibonacci Sequence Find GCD Check Prime Number ArrayList Loop HashMap Loop Loop Through an Enum
🌐
W3Schools
w3schools.com › java › java_ref_string.asp
Java String Reference
Java Wrapper Classes Java Generics Java Annotations Java RegEx Java Threads Java Lambda Java Advanced Sorting ... How Tos Add Two Numbers Swap Two Variables Even or Odd Number Reverse a Number Positive or Negative Square Root Area of Rectangle Celsius to Fahrenheit Sum of Digits Check Armstrong Num Random Number Count Words Count Vowels in a String Remove Vowels Count Digits in a String Reverse a String Palindrome Check Check Anagram Convert String to Array Remove Whitespace Count Character Frequency Sum of Array Elements Find Array Average Sort an Array Find Smallest Element Find Largest Element Second Largest Array Min and Max Array Merge Two Arrays Remove Duplicates Find Duplicates Shuffle an Array Factorial of a Number Fibonacci Sequence Find GCD Check Prime Number ArrayList Loop HashMap Loop Loop Through an Enum
🌐
Scaler
scaler.com › home › topics › reverse a string in java
Reverse a String in Java - Scaler Topics
March 14, 2024 - Reversing a string in Java by extracting each character and adding it in front of the existing string is a straightforward approach. This method iterates through the input string, takes each character, and places it at the beginning of a new string.
🌐
Medium
medium.com › @AlexanderObregon › javas-stringbuilder-reverse-method-explained-b2b701ee2029
Java’s StringBuilder.reverse() Method Explained | Medium
October 3, 2024 - Learn how Java's StringBuilder reverse() method works, its use cases like palindrome checking, and how it compares to manual reversal techniques.
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › reverse-a-string-in-java
Reverse a String in Java? - A Complete Guide
Each character must be added to the 'reversed' string in reverse order using the '+=' operator. Finally, return the 'reversed' string. In the main Java Method, call the 'reverse' method with an example string and print out the original and reversed ...
🌐
FavTutor
favtutor.com › blogs › reverse-string-java
Reverse a String in Java (with Examples)
September 28, 2024 - Using this method, we will instantiate a Stack object of characters and push all the characters of the original string into the stack using the stack’s inbuilt function push(). Since stack follows the principle of “First In Last Out”, characters will be popped out the characters in reversed order. Hence, we will create a new string and pop all characters from the stack, and concatenate them in the new string as shown in the below example ... import java.util.Stack; public class ReverseStringByFavTutor { public static void main(String[] args) { String stringExample = "FavTutor"; System.ou
🌐
Hero Vired
herovired.com › learning-hub › blogs › reverse-a-string-in-java
How to Reverse a String in Java Using for Loop | Hero Vired
Learn how to reverse a string in Java with our easy-to-follow tutorial. From built-in functions to loops and conditionals, we'll show you how to handle any scenario.
🌐
Emeritus
emeritus.org › home › blog › information technology › 9 most convenient ways to reverse a string in java
9 Most Convenient Ways to Reverse a String in Java
September 24, 2024 - Reverse a string in Java. Learn efficient methods using StringBuilder or recursion. Boost your Java skills with our easy guide.
🌐
Codecademy
codecademy.com › docs › java › stringbuilder › .reverse()
Java | StringBuilder | .reverse() | Codecademy
August 22, 2022 - The .reverse() method returns a modified StringBuilder object with its character sequence rearranged in the opposite order. This is the most straightforward way to reverse a string in Java.
🌐
Baeldung
baeldung.com › home › java › java string › how to reverse a string in java
How to Reverse a String in Java | Baeldung
January 8, 2024 - We’ll start to do this processing using plain Java solutions. Next, we’ll have a look at the options that third-party libraries like Apache Commons provide. Furthermore, we’ll demonstrate how to reverse the order of words in a sentence. We know that strings are immutable in Java.
🌐
Reddit
reddit.com › r/learnprogramming › explanation for how this recursive method to reverse a string works (java)
r/learnprogramming on Reddit: Explanation for how this recursive method to reverse a string works (JAVA)
February 21, 2021 -
public String reverse(String str) {
    if(str.length()==0){
        return str;
    }
    else{
        return reverse(str.substring(1))+str.charAt(0);
    }
}

I was wondering how recursive methods work. What causes this method continue to plug itself back into the function? When does str.length==0 and why does it end up returning a reversed string rather than a blank in my main method.

🌐
Medium
medium.com › womenintechnology › 3-ways-to-reversing-string-in-java-b40a23bbcc6c
3 ways to Reversing String In JAVA | by Daily Debug | Women in Technology | Medium
August 10, 2023 - String reveresed = str.chars().mapToObj( c -> (char)c). reduce("",(sa,c)->c+sa,(s1,s2)->s2+s1);System.out.println("Reversed String :"+reveresed); It’s also common in interviews that they ask to reverse a sentence without disturbing its sequence.