In the following fragment of code, I hope that the text is printed inside the if
but when I execute it I see that it does not enter. I have verified that both objects have the same data to be considered equal. What can I be doing wrong?
public void maestrosColonia(Profesor [] profesores,String colonia){
for(int i=0;i<profesores.length;i++) {
if(colonia == profesores[i].getDireccion().getColonia()){
System.out.println(profesores[i].getNombre()+" "+profesores[i].getNss()+" "+profesores[i].getTelefonos().getTelCasa());
}
}
}