import java.io.*;
public class srev {
public static void main(String[] args) {
int i,j;
String s="abcdef";
char c[] = s.toCharArray();
char d[] = s.toCharArray();
for(i=0;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]); }
System.out.println("\n String Reverse ");
StringBuffer result = new StringBuffer();
result.append(d[0]);
for (i=1; i
{
result.append(d[i]);
} System.out.println("\n the result string :"+result);
}}
No comments:
Post a Comment