title: Why can i not cast this string as an int?
body: <p>I'm having problems when taking a value out of a list and then casting it as an integer so I then can use it for different math functions, such as multiplication.</p>
  
  <p>Current code :</p>
  
  <pre><code>int i = 0;
  while(i &lt; student_id.size()){
      String finding = student_id.get(i).toString();
      int s101 = ((Integer)score101.get(student101.indexOf(finding))); // &lt;----this is where im having problems
      System.out.println(student_id.get(i)+" "+names.get(i));
      System.out.println("IR101 " + 
                         score101.get(student101.indexOf(finding)) +
                         " IR102 " +
                         score102.get(student102.indexOf(finding)));
      i++;
  }
  </code></pre>
  
  <p>The error that im getting is <code>java.lang.String cannot be cast to java.lang.Integer</code>. This confuses me because I thought it would have been an object. I have tried to convert it to an integer from both an object and a String but both throw up errors. How can I convert <code>score101.get(student101.indexOf(finding))</code> to an int ?</p>