外向型孤独症患者图片:JAVA问题

来源:百度文库 编辑:中科新闻网 时间:2024/05/01 22:40:58
public class Test{
public static void main(String args[]){
if(odd(5))
System.out.println("odd");
else
System.out.println("Even");
}

public static int odd(int x){return x%2;}
}

A the output is odd
B the output is even
C An error on line3 causes compilation to fail
D An error on line 8 causes compilation to fail

选C

因为JAVA中if语句中的参数不能象C和C++那样用INT型来判定,只能用boolean 型