kitcoop
asked on
meaning of percent sign in java SDK2.0
what does the percent sign in this code mean?
if(y % 2 == 1)
system.out.println(a);
if(y % 2 == 1)
system.out.println(a);
Hi kitcoop,
> if(y % 2 == 1)
> system.out.println(a);
It represents a modular (Remainder) operator.
Cheers!
> if(y % 2 == 1)
> system.out.println(a);
It represents a modular (Remainder) operator.
Cheers!
It is part of arithmetic operator
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arithmetic.html
David
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arithmetic.html
David
% has the same meaning in ALL JAVA versions!
;JOOP!
;JOOP!
yeah and it has not been changed since C, C++ ;-)
In that case it means 'if y is an odd number'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes
The comments by avinthm, sys_prog, suprapto45, and CEHJ contain correct answers to this question. The points should probably be reawarded or split.
Thanks much.
(also, this really wasn't worth 500pts)
Thanks much.
(also, this really wasn't worth 500pts)
y % 2 results in remainder after dividing y by 2
cheers