打印輸出語句:System.out.println("內容"+i+1+"內容");與System.out.println("內容"+(i+1)+"內容");的區別

連接符和 “+”運算符區別


測試語句:

package com.it.test;


public class Test {
    public static void main(String[] args) {
        int i=3;
        System.out.println("abc"+i+1+"def");
        System.out.println("abc"+(i+1)+"def");
    }

}


結果:

abc31def
abc4def



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章