Автобоксинг в Java

Как оценивается следующее выражение?

Класс Student :

public class Student
{
    private Integer id;
    // few fields here

    public Integer getId()
    {
        return id;
    }

    public void setId(Integer id)
    {
        this.id=id;
    }

    //setters and getters
}

И в некотором методе:

{
    int studentId;

    // few lines here

    if(studentId==student.getId())  // **1. what about auto-unboxing here? Would it compare correctly? I am not sure.**
    {
        //some operation here
    }
}
5
задан Nandkumar Tekale 13 December 2011 в 11:50
поделиться