public class srev {
public static void main(String[] args) {
int i,j;
String s="abc";
char c[] = s.toCharArray();
char d[] = s.toCharArray();
for(i=0;i < s.length();i++)
{
System.out.print(" "+c[i]);
}
i=0;
for(j=s.length()-1;j>=0;j--)
{
d[i]=c[j];
i++;
}
System.out.println("\n String Reverse ");
for(i=0;i
System.out.print(" "+d[i]);
}
}
}
No comments:
Post a Comment