/*****************************************************************
** StringBackwards - program to demonstrate simple loops
**
** A message string is assigned to a string variable.  Using a
** 'for' loop, the string is output one character at a time,
** starting at the end of the string and working back toward
** the front of the string.
**
** A output of this program is
**
**    dlrow ,olleH
**
** (c) Scott MacKenzie, 2000                             
******************************************************************/
public class StringBackwards
{
   public static void main(String[] args)
   {
      String s = "Hello, world";
      int length = s.length();
      for (int i = length; i > 0; i--)
         System.out.print(s.substring(i - 1, i));
   }
}

