This is my code
package zh.codegym.task.task06.task0606;

import java.io.*;

/*
偶数和奇数
*/

public class Solution {

    public static int even;
    public static int odd;

    public static void main(String[] args) throws IOException {
        //在此编写你的代码
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(reader.readLine());

        Solution.even = 0;
        Solution.odd = 0;

        while(true){
            if(n / 10 != 0){
                /*if (((n % 10) % 2) == 1)
                    Solution.odd++;
                else
                    Solution.even++;*/
                n /= 10;
                (((n % 10) % 2) == 1) ? odd++ : even++;
            }
            else{
                //((n % 2) == 1) ? odd++: even++;
                if ((n % 2) == 1)
                    odd++;
                else
                    even++;
                System.out.println("偶数: " + Solution.even + " 奇数: " + Solution.odd);
                break;
            }

        }
    }
}
However, when I used ternary operator, the program failed to be compiled. If I change it to the if-else form, it works. I don't understand what happens to my ternary operator.