下列代码段编译和运行的结果是:( )
public static void main(String[] args) {
int value = 0;
boolean setting = true;
String title = "Hello";
if (value || (setting && title == "Hello")) {
return 1;
}
if (value == 1 & title.equals("Hello")) {
return 2;
}
}2
1
编译错误
可以运行,但无输出
1:运算符 '||' 不能应用于 'int'、'boolean'
2:void函数,不能return
2:void函数,不能return