public class StringRev {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String s="Welcome";
int s1=s.length();
for(int i=s1-1;i>=0;i--)
{
System.out.print(s.charAt(i));
}
System.out.print("\n");
System.out.println("length of the String"+s1);
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String s="Welcome";
int s1=s.length();
for(int i=s1-1;i>=0;i--)
{
System.out.print(s.charAt(i));
}
System.out.print("\n");
System.out.println("length of the String"+s1);
}
}
Out put is:
ReplyDeleteemocleW
length of the String7