I'd like to ask about using the modulus operation, could someone tell me how to use an if statement, why use [== 0], but we can assign the value from a modulus calculation into another variable.
Why does below code work?
int number = 100;
if(number % 2 == 0)
{
sout(number);
}
and why does this one also work not using if?
lastDigit = number % 10;
why doesn't below statement work?
if(number % 2)
{
sout (number);
}