File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Increment and Decrement Operators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Increment and Decrement Operators" Watch "Increment and Decrement Operators" New topic
Author

Increment and Decrement Operators

Saumya Tangeda
Greenhorn

Joined: Jul 09, 2006
Posts: 24
I read about the rules for unary and binary numeric promotion.
Unary numeric promotion is valid for operators:+,-,~,[],<<,>>>,>>
Binary numeric promotion is valid for: -relational operators
-bitwise operators
- == and !=
-arithmetic operators
Does the type promotion occur for ++ and - - operators?What type?Unary or Binary?
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Yes, it happens. Promotion and autocasting.

For instance:



This is equal to:



The ++ and -- operators act on a single operand, therefore the answer to your questions regarding if this is a binary or unary numeric promotion is evident.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Increment and Decrement Operators