15.14
Unary Operators
EXPRESSIONS
variable and the difference is stored back into the variable. Before the subtraction,
binary numeric promotion ( 5.6.2) is performed on the value
1
 and the value of
the variable. If necessary, the difference is narrowed by a narrowing primitive con 
version ( 5.1.3) to the type of the variable before it is stored. The value of the
postfix decrement expression is the value of the variable
before
the new value is
stored.
A variable that is declared
final
 cannot be decremented, because when an
access of a
final
 variable is used as an expression, the result is a value, not a
variable. Thus, it cannot be used as the operand of a postfix decrement operator.
15.14   Unary Operators
The
unary operators
 include
+
,
,
++
,
  
,
~
,
!
, and cast operators. Expressions
with unary operators group right to left, so that
 ~x
 means the same as
 (~x)
.
UnaryExpression
:
PreIncrementExpression
PreDecrementExpression
+
UnaryExpression
UnaryExpression
UnaryExpressionNotPlusMinus
PreIncrementExpression
:
++
UnaryExpression
PreDecrementExpression
:
  
UnaryExpression
UnaryExpressionNotPlusMinus
:
PostfixExpression
~
UnaryExpression
!
UnaryExpression
CastExpression
The following productions from  15.15 are repeated here for convenience:
CastExpression:
(
PrimitiveType
 )
UnaryExpression
(
ReferenceType
 )
UnaryExpressionNotPlusMinus
This portion of the Java grammar contains some tricks to avoid two potential
syntactic ambiguities.
The first potential ambiguity would arise in expressions such as
(p)+q
, which
looks, to a C or C++ programmer, as though it could be either be a cast to type
p
346






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