【发布时间】:2013-05-10 12:14:21
【问题描述】:
我有以下代码
public class Test {
public static void main(String[] args) {
Integer i1=null;
String s1=null;
String s2=String.valueOf(i1);
System.out.println(s1==null+" "+s2==null);//Compilation Error
System.out.println(s1==null+" ");//No compilation Error
System.out.println(s2==null+" ");//No compilation error
}
}
为什么将两个布尔值与字符串结合会出现编译错误
编辑:编译错误是 运算符 == 未定义参数类型 boolean, null
【问题讨论】:
-
以后,如果你要发布不能编译的代码并询问编译错误的原因,请包含错误。
-
对不起,我添加了编译错误