Using Java
1) Using StringBuffer class
In this method, we use reverse() method of StringBuffer class to reverse the string. Here is the code snippet to reverse the string using reverse() method of StringBuffer class.
StringBuffer sbf = new StringBuffer("MyJava");
System.out.println(sbf.reverse()); //Output : avaJyM
2) Using iterative method
In this method, first we convert given string to char array using charArray() method. And then we iterate that array in the reverse order.
String str = "MyJava";
char[] strArray = str.toCharArray();
for (int i = strArray.length - 1; i >= 0; i--)
{
System.out.print(strArray[i]); //Output : avaJyM
}