I can’t think of a way in the language itself, but you can easily emulate it like this:
ChildA child = (obj instanceof ChildA ? (ChildA)obj : null);
I can’t think of a way in the language itself, but you can easily emulate it like this:
ChildA child = (obj instanceof ChildA ? (ChildA)obj : null);