<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">public class ForDemo {
  
  /**
   * initialization;
   * while(condition) {
   *   body
   *   updatestatement
   * }
   * 
   * for(initialization; condition; updatestatement) {
   *   body
   * }
   * 
   * For loops are good to use when you know the range
   * and bad otherwise.
   */ 
  
  /** 
   * Return the string s with the characters reversed.
   */ 
  public static String reverse(String s) {
    String rev = "";
    
    for(int i = 0; i &lt; s.length(); i++) {
      rev = s.charAt(i) + rev;
    }
    
    return rev;
  }
}</pre></body></html>