Допоможіть зрозуміти чому не пропускає другий пункт. Де помилка?
package ua.javarush.task.pro.task10.task1010;
import java.util.Objects;
/*
Два айфони
*/
public class Iphone {
private String model;
private String color;
private int price;
public Iphone(String model, String color, int price) {
this.model = model;
this.color = color;
this.price = price;
}
@Override
public boolean equals (Object o){
if (this==o)
return true;
if (o==null)
return false;
if (!(o instanceof Iphone))
return false;
Iphone a=(Iphone) o;
if (this.model==null)
return a.model==null;
if (this.color==null)
return a.color==null;
return this.price ==a.price&&this.model.equals(a.model)&&this.color.equals(a.color);
}
//напишіть тут ваш код
public static void main(String[] args) {
Iphone iphone1 = new Iphone("X", "Black", 999);
Iphone iphone2 = new Iphone("X", "Black", 999);
System.out.println(iphone1.equals(iphone2));
}
}