meaning of percent sign in java SDK2.0

what does the percent sign in this code mean?

if(y % 2 == 1)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi ,

y % 2 results in remainder after dividing y by 2

Hi kitcoop,
> if(y % 2 == 1)
>      system.out.println(a);

It represents a modular (Remainder) operator.

Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

% has the same meaning in ALL JAVA versions!

Mayank SAssociate Director - Product EngineeringCommented:
yeah and it has not been changed since C, C++ ;-)
In that case it means 'if y is an odd number'
In that case it means 'if y is an odd number'

Actually it means if y is an odd number greater than 0.

-3 % 2 = -1

if(y % 2 != 0)   is a better 'if y is an odd number' statement.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.