aspose file tools*
The moose likes Beginning Java and the fly likes Arithmetic Compound Assignment Operators.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Arithmetic Compound Assignment Operators.." Watch "Arithmetic Compound Assignment Operators.." New topic
Author

Arithmetic Compound Assignment Operators..

Phillipe Rodrigues
Ranch Hand

Joined: Oct 30, 2007
Posts: 165
Why i get output for the below program?

---------- Run ----------
Hello World!
Normal Termination
Output completed (0 sec consumed).





Thanks,
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39791
    
  28
To the Batmobile!

Oh no, that should be Java Language Specification, or anywhere where you can read that the compound operators can return their original type rather than going to int.

It is quite complicated; they can create an int and then return it to their original type, so your example will compile and run happily, but you can get some unexpected results if you use types "narrower" than int (short, byte, char). It is described lot better in the Java Language Specification page I showed you. "Complete abruptly" means to suffer an exception at runtime.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Arithmetic Compound Assignment Operators..