Hi friends,
in the below code Relatable is the interface name.
public Object findLargest(Object object1, Object object2) {
Relatable obj1 = (Relatable)object1;
Relatable obj2 = (Relatable)object2;
if ( (obj1).isLargerThan(obj2) > 0)
return object1;
else
return object2;
}
I read that we can use a reference type just like other datatypes.
Then how can we call a function using reference datatype variable like in the above code ?
and also they placed obj1 in the if condition in ().
what it indicates ?