Can the following
<?=($Num&1) ? "odd" : "even"?>
translate to an equivalent in Java?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
String s = (num % 2 == 0) ? "even" : "odd";To be thorough, that isn’t the same operator that you’re using (bitwise AND). Bitwise AND is the same in java, so you could also write your php line like:
String s = (num & 1 == 0) ? "even" : "odd";