title: Error: incompatible types Object Could not be converted [ArrayList]
body: <p>I am getting a compiler error in my for loop declaration: <code>incompatible types: Object cannot be converted to Type2</code></p>
  
  <p>I am trying to do this : <a href="https://stackoverflow.com/questions/11477195/java-list-of-objects-find-objects-with-a-certain-value-in-a-field">Java - List of objects. Find object(s) with a certain value in a field</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>import java.util.ArrayList;
  
  public class Test2 {
      String name;
      int value;
      public ArrayList list = new ArrayList&lt;Test2&gt;();
  
      public void q() {
          for(Test2 w : list) { // Here is the error: 'incompatible types: Object cannot be converted to Test2'
              if(w.value == 10)
                  System.out.println(w.name);
          }
      }
  }
  </code></pre>