title: Boolean value assignment in Java
body: <p>Apologies for the total noob question, but can anyone explain what's happening to the value of <code>match</code> after the for-each loop has finished in the following method? </p>
  
  <p>Attempts to compile produce the warning: <code>variable match might not have been initialised</code>.</p>
  
  <pre><code>public void listMatching(String searchString) {
  boolean match;
  
  for(String filename : files) {
      if(filename.contains(searchString)) {
          System.out.println(filename);
          match = true;
      }
      else {
          match = false;
      }
  }
  
  if(match == false) {
      System.out.println("No matches found for " + searchString);
  }
  }
  </code></pre>