CONVERSIONS AND PROMOTIONS
Casting Conversion
5.5
5.4   String Conversion
String conversion applies only to the operands of the binary
+
 operator when one
of the arguments is a
String
. In this single special case, the other argument to the
+
 is converted to a
String
, and a new
String
 which is the concatenation of the
two strings is the result of the
+
. String conversion is specified in detail within the
description of the string concatenation
+
 operator ( 15.17.1).
5.5   Casting Conversion
Sing away sorrow, cast away care.
 Miguel de Cervantes (1547 1616),
Don Quixote
 (Lockhart s translation), Chapter viii
Casting conversion
 is applied to the operand of a cast operator ( 15.15): the type
of the operand expression must be converted to the type explicitly named by the
cast operator. Casting contexts allow the use of an identity conversion ( 5.1.1), a
widening primitive conversion ( 5.1.2), a narrowing primitive conversion
( 5.1.3), a widening reference conversion ( 5.1.4), or a narrowing reference con 
version ( 5.1.5). Thus casting conversions are more inclusive than assignment or
method invocation conversions: a cast can do any permitted conversion other than
a string conversion.
Some casts can be proven incorrect at compile time; such casts result in a
compile time error.
A value of a primitive type can be cast to another primitive type by identity
conversion, if the types are the same, or by a widening primitive conversion or a
narrowing primitive conversion.
A value of a primitive type cannot be cast to a reference type by casting con 
version, nor can a value of a reference type be cast to a primitive type.
The remaining cases involve conversion between reference types. The
detailed rules for compile time correctness checking of a casting conversion of a
value of compile time reference type
S
 (source) to a compile time reference type
T
 (target) are as follows:
67






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