Basic calculator solution doubt

import java.util.Scanner;

public class main{

static Scanner scn=new Scanner(System.in);

public static void main(String[] args) {

    char ch;

    do {

        ch = scn.next().charAt(0);  // Use cin in case of c++

        if (ch == '+' || ch == '-' || ch == ' * ' || ch == '/' || ch == '%') 

{
operation(ch);

        } else {

            if (ch != 'x' && ch != 'X')

                System.out.println("Invalid operation. Try 

again.");

        }

    } while (ch != 'x' && ch != 'X');

}

public static void operation(char ch) {

    int a = scn.nextInt(); // Use cin in case of c++

    int b = scn.nextInt(); // Use cin in case of c++

    int res = 0;

    switch (ch) {

    case '+': {

        res = a + b;

        break;

    }

    case '-': {

        res = a - b;

        break;

    }

    case '*': {

        res = a * b;

        break;

    }

    case '/': {

        res = a / b;

        break;

    }

    case '%': {

        res = a % b;

        break;

    }

    }

    System.out.println(res);

}

}

//in this solution do while solution is ch!=‘X’ and ch!=‘x’
this condition will always be false as for the condition to be true both should be true but its not possible ch to have both ‘X’ and ‘x’ at a time isnt it?

@tejasddongare ch != x && ch != X is checking that both of these are NOT equal to ‘x’. It is not checking for equality, it is checking for inequality. Yes it is not possible to have both x and X at the same time, but we dont need it to be.
Suppose ch = a then in that case, both conditions are true and while loop will continue. But if ch = ‘x’ then second condition will be false, and while loop will not run because both conditions need to be true.