162488/reverse-a-string-in-java
To answer your question, you can use the following line of code:-
new StringBuilder(hi).reverse().toString()
The StringBuilder was added in Java 5. For the prior versions to Java 5, the StringBuffer class can be used instead which uses the same API.
public static String reverse(String s) { ...READ MORE
I have "Hello World" kept in a ...READ MORE
Here is the code to reverse a ...READ MORE
Here are two ways illustrating this: Integer x ...READ MORE
You can concatenate Strings using the + operator: System.out.println("Your number ...READ MORE
System.arraycopy is the most efficient way, but ...READ MORE
Strings are immutable. That means once you've ...READ MORE
In Java, you can escape quotes with \: String ...READ MORE
The reason for the inaccuracy is because ...READ MORE
Use the lines of code mentioned below:- String ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.