Joined
·
358 Posts
Hello guys i want to reverse a string in java.e.g
"hello how are u"
it should be displayed as
"u era woh olleh"
i have tried this but unable.
"hello how are u"
it should be displayed as
"u era woh olleh"
i have tried this but unable.
Code:
String s="hello how are you";
String temp=s;
int j=0;
for(int i=s.length();i>=0;i--)
{
s.chatAt(i)=temp.charAt(j);
j++;
}