Meaning of + symbol with Strings in Java println statement

后端 未结 7 910
孤独总比滥情好
孤独总比滥情好 2021-01-16 09:57

I\'m new to Java. What does the below mean?

(addition) + sign in println

System.out.println ("Count is: " + i);

7条回答
  •  离开以前
    2021-01-16 10:14

    + is string concatenation operator and it is used for conversion of other objects to strings (based upon the implementation of toString() method) and also concatenate two strings.

    String str1="Hello";
    String str2="World"
    
    String result=str1 + " " + str2;
    

提交回复
热议问题