java string reverse
public class ReverseString {
public static void main(String[] args) {
String s1 = "neelendra";
for(int i=s1.length()-1;i>=0;i--)
{
System.out.print(s1.charAt(i));
}
}
}String str = "Hello";
String reverse(String str){
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.reverse();
return sb.toString();
}String str = "Reverse this strings";
//for loop
for (int i = str.length() - 1; i >= 0; i--) {
System.out.print(str.charAt(i));
}
// StringBuffer for multi thread
StringBuffer sb = new StringBuffer();
sb.append(str);
System.out.print(sb.reverse().toString());
// StringBuffer for single thread
StringBuilder sb = new StringBuilder();
sb.append(str);
System.out.print(sb.reverse().toString());
Also in Java:
- countdown timer with seekbar
- java initialize int array
- check last character of string java
- why static variables cannot be serialized in java
- jstl core tags
- java random between two strings
- has places api got deprecated???
- org.mapstruct maven dependency
- get first 5 characters of string java
- restart application programmatically android
- isnumber java
- print arraylist java
- JFrame text java
- determine if a given binary tree is a valid bst
- how to do for each in java
- create java windows application
- java output length of each line in a text document
- split every character in string into array java
- initialize arraylist
- java random number
- arraylist add method
- square root java
- java function that returns the index of the largest value in an array
- java divisible by operator