有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (3) 个答案

  1. # 1 楼答案

    x()语句是一个带有参数y的方法调用,它为求值返回一个boolean

  2. # 2 楼答案

    引用Java Language Specification section 14.9if语句:

    IfThenStatement:
        if ( Expression ) Statement
    

    [...]

    The Expression must have type boolean or Boolean, or a compile-time error occurs.

  3. # 3 楼答案

    x是一个方法,y是它的参数

    Method x获取parameter y并返回一个booleanBoolean,假设它z,然后它像if(z)一样执行

    例如:

    boolean x(int y) {
        if (y == 0) {
            return true;
        } else{
            return false;
        }
    }
    

    int y = 1;
    if(x(y)) {
        System.out.print("y is zero");
    }