Új hozzászólás Aktív témák
-
sztikac
őstag
Ha már MOOC... Van ez a kód:
public boolean equals(Object compared) {
// if the variables are located in the same position, they are equal
if (this == compared) {
return true;
}
// if the compared object is not of type Person, the objects are not equal
if (!(compared instanceof Person)) {
return false;
}
// convert the object into a Person object
Person comparedPerson = (Person) compared;
// if the values of the object variables are equal, the objects are equal
if (this.name.equals(comparedPerson.name) &&
this.age == comparedPerson.age &&
this.weight == comparedPerson.weight &&
this.height == comparedPerson.height) {
return true;
}
// otherwise the objects are not equal
return false;
}Itt nem igazán értem, hogy a type cast-ra (
Person comparedPerson = (Person) compared;
) mi szükség van, hiszen a metódus már megkapja a compared objektumot
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- Bomba ár! Dell Latitude E6230 - i5-3GEN I 8GB I 320GB I 12,5" HD I HDMI I Cam I W10 I Garancia!
- ÁRGARANCIA! Épített KomPhone Ryzen 7 9700X 32/64GB RAM RX 9070 16GB GAMER PC termékbeszámítással
- Okosított PS4 Slim 11.00 GoldHEN 500GB - Telepített játékokkal
- Honor 200 Smart 256GB Kártyafüggetlen, 1Év Garanciával
- AKCIÓ! ASUS Z97-A Z97 chipset alaplap garanciával hibátlan működéssel
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest