if语句完成下面问题 求了

判断int类型变量a和b是否相等,判断int类型变量a和c是否相等,并分别打印输出判断的结果,用if语句完成

我不明白你想知道啥

示例代码如下:

public class Main {

    public static void main(String[] args) throws IOException {
        int a = 1;
        int b = 1;
        int c = 2;
        if (a == b) {
            System.out.println("a = b is true");
        }
        if (a == c) {
            System.out.println("a = c is true");
        }
    }
}

如有帮助,请采纳。


public class Main {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        int c = 10;
        if(a ==b){
            System.out.println("a和b相等");
        }else{System.out.println("a和b不想等");}

        if(a == c){
            System.out.println("a和c相等");
        }else{System.out.println("a和c不相等");}
    }

}