3 ms·
And that "older Java" example itself is an alternative (added in Java 16, from looking it up) to what existed before. if (obj instanceof Point) { Poin
by trealira 3y ago
And that "older Java" example itself is an alternative (added in Java 16, from looking it up) to what existed before.
if (obj instanceof Point) {
Point p = (Point) obj;
int x = p.x();
int y = p.y();
System.out.println(x + y);
}