[ bane @ 31.10.2018. 16:55 ] @
@Override public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) { return false; } if(getClass() != obj.getClass()) return false; Car other = (Car) obj; if(!manufacturer.equals(other.manufacturer)) return false; if(!engine.equals(other.engine)) return false; if(!color.equals(other.color)) return false; return true; } Ono što mi nije jasno: if(getClass() != obj.getClass()) return false; A zatim Car other = (Car) obj; Zašto ako su upitanju iste klase, imamo casting? |