CONVERSIONS AND PROMOTIONS
Narrowing Reference Conversions
5.1.5
From any interface type to type
Object
.
From any array type to type
Object
.
From any array type to type
Cloneable
.
From any array type
SC[]
 to any array type
TC[]
, provided that
SC
 and
TC
are reference types and there is a widening conversion from
SC
 to
TC
.
Such conversions never require a special action at run time and therefore never
throw an exception at run time. They consist simply in regarding a reference as
having some other type in a manner that can be proved correct at compile time.
See  8 for the detailed specifications for classes,  9 for interfaces, and  10 for
arrays.
5.1.5   Narrowing Reference Conversions
The following conversions are called the
narrowing reference conversions
:
From any class type
S
 to any class type
T
, provided that
S
 is a superclass of
T
.
(An important special case is that there is a narrowing conversion from the
class type
Object
 to any other class type.)
From any class type
S
 to any interface type
K
, provided that
S
 is not final and
does not implement
K.
 (An important special case is that there is a narrowing
conversion from the class type
Object
 to any interface type.)
From type
Object
 to any array type.
From type
Object
 to any interface type.
From any interface type
J
 to any class type
T
 that is not
final
.
From any interface type
J
 to any class type
T
 that is
final
, provided that
T
implements
J
.
From any interface type
J
 to any interface type
K
, provided that
J
 is not a sub 
interface of
K
 and there is no method name
m
 such that
J
 and
K
 both declare a
method named
m
 with the same signature but different return types.
From any array type
SC[]
 to any array type
TC[]
, provided that
SC
 and
TC
are reference types and there is a narrowing conversion from
SC
 to
TC
.
Such conversions require a test at run time to find out whether the actual reference
value is a legitimate value of the new type. If not, then a
ClassCastException
 is
thrown.
59






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved