printing an int value right after a String value

前端 未结 9 1424
日久生厌
日久生厌 2021-01-27 06:00

I have the following example code:

int pay = 80;
int bonus = 65;
System.out.println(pay + bonus + \" \" + bonus + pay);

could someone please ex

9条回答
  •  伪装坚强ぢ
    2021-01-27 06:20

    Because, this is operator overloading issue. Here, First + is plus operator and last + is concat operator.

     System.out.println(pay + bonus + " " + bonus + pay);
                            |                     |
                          (plus)                (concat)
    

提交回复
热议问题