How does following expression evaluated?
Student class :
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
}
And in some method :
{
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
}
}