Jestem początkujący programista i natknąłem się na to w moim podręczniku:Nawiasy wokół typu danych?
public boolean equals(DataElement otherElement)
{
IntElement temp = (IntElement) otherElement;
return (num == temp.num);
}
IntElement
jest podklasą DataElement
. num
to int przechowujące wartość dla połączonej listy.
Jaki jest cel (IntElement)
po temp =?
Co byłoby nie tak z IntElement temp = otherElement
? I na ogół, co robi umieszczanie typu danych w nawiasach podobnych do tego?