aspose file tools*
The moose likes Beginning Java and the fly likes %= operator? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "%= operator?" Watch "%= operator?" New topic
Author

%= operator?

Randy Trover
Ranch Hand

Joined: Feb 26, 2001
Posts: 34
Hi all,
I know the mod operator is %, but what does the %= do? Thanks for any help.
Cheers
Randy
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
a %= b is the same as
a = a % b;
where you stuff the result back into the a value that you started with.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Works just like '+=', '-=', and all the other math shortcut operators...



Both have the same effect... they assign the modulus of someNum and 5 to someNum...

HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: %= operator?
 
Similar Threads
can any one explain this
Picking variables with a given propability
Iterations - finding the same value for 2 variables
Interview Question
convert Postiive number to negative..