title: Need to initialize a variable again to zero in for loop
body: <p>This is my code. I need the <code>i</code> value to get initialized again to zero when a particular character is deleted from two strings. Here <code>sb</code> refers to first string entered by the user and <code>sb1</code> refers to second string entered by user. When both the characters are same while comparing, the char should be deleted from both of the strings and the value of <code>i</code> should be reinitialized to zero and start comparing from first character of first string with the first char of second string. Everything is working fine but the value of <code>i</code> is not initialized again to zero, instead it gets incremented.</p>
  
  <pre><code>for (i = 0; i &lt; sb.length(); i++) {
      for (j = 0, d = 0; j &lt; sb1.length(); j++) {
          if (sb.charAt(i) == sb1.charAt(j)) {
              sb.deleteCharAt(i);
              i = 0;
              System.out.println("the buff=" + sb);
  
              sb1.deleteCharAt(j);
              System.out.println("the buff=" + sb1);
  
              break;
          }
      }
  }
  </code></pre>