Thursday 14 September 2017

Java Data Type Casting

Cited from the Book Java How to Program

A cast operator is formed by placing parentheses around any type’s name. The operator is a unary operator (i.e., an operator that takes only one operand). Java also supports unary versions of the plus (+) and minus (–) operators, so you can write expressions like -7 or +5. Cast operators associate from right to left and have the same precedence as other unary operators, such as unary + and unary -. This precedence is one level higher than that of the multiplicative operators *, / and %.

No comments:

Post a Comment