title: Convert loop index to string
body: <p>Okay so I want to create a for loop that assigns variables with each increment of <code>i</code>. This is what I have, but it doesn't work due to a type mismatch:</p>
  
  <pre><code>int i;
  String d;
  for(i = 5; i &gt; 0; i--){
  String.valueOf(i);
  d = i;
  d = reader.readLine();
  System.out.println(d);
  }
  </code></pre>
  
  <p>So the error that I get right now is "type mismatch" when setting <code>d = i</code>. Obviously I get the error due to <code>d</code> not being an int but a String, but I thought <code>String.valueOf(i)</code> was supposed to convert <code>i</code> to a String? I must have misunderstood this. What am I doing wrong in this or what is another way to do this?</p>