1public class ReverseString {
2 public static void main(String[] args) {
3 String s1 = "neelendra";
4 for(int i=s1.length()-1;i>=0;i--)
5 {
6 System.out.print(s1.charAt(i));
7 }
8 }
9}
1String string="whatever";
2String reverse = new StringBuffer(string).reverse().toString();
3System.out.println(reverse);
4
1String str = "Hello";
2String reverse(String str){
3 StringBuilder sb = new StringBuilder();
4 sb.append(str);
5 sb.reverse();
6 return sb.toString();
7}
1StringBuilder sb1 = new StringBuilder("Mahmut");
2 sb1.reverse();
3 System.out.println(sb1); // tumhaM
11)
2String str = "Hello";
3String result = "";
4
5 for(int i = str.length()-1; i>=0; i--){
6 result += str.charAt(i); // first solution, charAt method
7 // result += str1.substring(i, i+1); // first solution, substring method
8 }
9 System.out.println(result);
10}
11
12