Witam.
public class kObject {
public static void main(String[] args) {
Punkt[] pk = new Punkt[5];
pk[0] = new Punkt(1,1);
pk[1] = new Punkt(2,5);
pk[2] = new Punkt(1,1);
pk[3] = new Punkt(1,4);
System.out.println(pk[0].equals(pk[2])); **//o co dokładnie tutaj chodzi? poeównuje pk[0] i pk[2] i wyskakuje false, natomiast jak porówna pk[0] i pk[0] to będzie true. O co dokładnie kaman?**
System.out.println(pk[2]);
}
}
class Punkt {
public Punkt(){
this.x = 0;
this.y = 0;
}
public Punkt(int x, int y){
this.x = x;
this.y = y;
}
private int x;
private int y;
}
O co dokładnie tutaj chodzi? poeównuje pk[0] i pk[2] i wyskakuje false, natomiast jak porówna pk[0] i pk[0] to będzie true. O co dokładnie kaman?