public Student retrieveById(int id)
<pre><code>public class Roster extends ArrayList&lt;Student&gt; 
{
public boolean containsStudent(String ln)
{ 
    Scanner user_input = new Scanner (System.in);
    System.out.println("Enter last name of student: ");
    String lName = user_input.next();
    for (Student student : this)
    {
        if (student.getLastName().equals(lName)) 
        return true;
    }
    return false; 
}
</code></pre>

<p>How can I fix the error in the next method:   </p>

<pre><code>public Student retrieveByld(int id)
{
    Scanner user_input = new Scanner (System.in);
    System.out.println("Enter the ID of the student: ");
    String idNum = user_input.next(); 
    for (Student student : this)
    {
        if (student.getID().equals(idNum)) 
        return student.getFullName();
    }
    return " "; 
}
</code></pre>

<p>Error: int cannot be dereferenced. I'm guessing I cannot compare to ints using the .equals method but how can I without changing the syntax too much. </p>

<p>Given the id, I have to make the program find the student in the list and return that students full name. If student not found I have to return null. If it helps here's my Student class. </p>

<pre><code>public class Student
{
    private String lName, fName;
    private int idNum;

public Student(int id, String fn, String ln)
{
lName = ln;
fName = fn;
idNum = id;
}

public String getFullName()
{
    return fName + " " + lName;
}

public String getLastName()
{
    return lName;
}

public String getFirstName()
{
    return fName;
}



public int getID()
{
    return idNum;
}

public String toString()
{
    return fName + " " + lName + " " + idNum;
}
}
</code></pre>
