问答详情
源自:3-4 Java中的比较运算符

System.out.println("a等于b:" + (a==b));中为什么要有+

public class HelloWorld{
    public static void main(String[] args) {
  int a=16;
  double b=9.5;
  String str1="hello";
  String str2="imooc";
  System.out.println("a等于b:" + (a==b));
  System.out.println("a大于b:" + (a>=b));
  System.out.println("a小于等于b:" + (a<=b));
  System.out.println("str1等于str2:" + (str1   ==str2));
 }
}

提问者:李杭天 2019-12-03 22:56

个回答

  • light_pan
    2019-12-03 23:22:38

    这是字符串连接符,String c = "xxxx" + "xcccccc";