Olá.
Estou com uma dúvida na resposta do Inquisition sobre a seguinte questão:
class test {
public static void main(String[] args) {
test inst_test = new test();
int i1 = 2000;
int i2 = 2000;
int i3 = 2;
int i4 = 2;
Integer Ithree = new Integer(2); // 1
Integer Ifour = new Integer(2); // 2
System.out.println( Ithree == Ifour );
inst_test.method( i3 , i4 );
inst_test.method( i1 , i2 );
}
public void method( Integer i , Integer eye ) {
System.out.println(i == eye );
}
}
Ele dá como resposta:
FALSE, TRUE, FALSE
Eu errei pois coloquei tudo False, mas não entendi o motivo de dar TRUE pois a comparação é com ==.
Alguém pode me ajudar?
Grato.