Java Reference
In-Depth Information
Table 5.2. Casting conversions to reference types
5.5.1. Reference Type Casting
Given a compile-time reference type
S
(source) and a compile-time reference type
T
(tar-
get), a casting conversion exists from
S
to
T
if no compile-time errors occur due to the fol-
lowing rules.
If
S
is a class type:
• If
T
is a class type, then either |
S
|
<:
|
T
|, or |
T
|
<:
|
S
|. Otherwise, a compile-time error
occurs.