title: Java: 2-assignments-2-initializations inside for-loop not allowed?
body: <p><a href="https://stackoverflow.com/questions/2614072/java-define-terms-initialization-declaration-and-assignment/2614178#2614178">Related question, about assignment-initialization-declaration.</a></p>
  
  <pre><code>$ javac MatchTest.java 
  MatchTest.java:7: ')' expected
    for((int i=-1 &amp;&amp; String match="hello"); (i=text.indexOf(match)+1);)
            ^
  MatchTest.java:7: ';' expected
    for((int i=-1 &amp;&amp; String match="hello"); (i=text.indexOf(match)+1);)
                           ^
  MatchTest.java:7: ';' expected
    for((int i=-1 &amp;&amp; String match="hello"); (i=text.indexOf(match)+1);)
                                         ^
  MatchTest.java:7: not a statement
    for((int i=-1 &amp;&amp; String match="hello"); (i=text.indexOf(match)+1);)
                                            ^
  MatchTest.java:7: illegal start of expression
    for((int i=-1 &amp;&amp; String match="hello"); (i=text.indexOf(match)+1);)
                                                                      ^
  5 errors
  $ cat MatchTest.java 
  import java.util.*;
  import java.io.*;
  
  public class MatchTest {
   public static void main(String[] args){
    String text = "hello0123456789hello0123456789hello1234567890hello3423243423232";
    for((int i=-1 &amp;&amp; String match="hello"); (i=text.indexOf(match)+1);)
     System.out.println(i);
   }
  }
  </code></pre>