国家开放大学 / java语言程序设计
下列代码段运行结果为( )。
int num = 15;
if (num % 2==0) {
System.out.println( "num " + num + " is 偶数");
} else {
System.out.println( "num " + num + "is 奇数");
}
A. "num 15 is 奇数"
B. "num 15 is 偶数"
C. 15
D. 2
int num = 15;
if (num % 2==0) {
System.out.println( "num " + num + " is 偶数");
} else {
System.out.println( "num " + num + "is 奇数");
}
A. "num 15 is 奇数"
B. "num 15 is 偶数"
C. 15
D. 2
参考答案: