String concatenation +

10+20=30;
" “+10+20=1020;
10+20+” "=30;

public class demo5 {
    
    
    public static void main(String[] args) {
    
    
    int a = 10;
    int b = 20;

        System.out.println(a+b);

        //字符串连接符 +
        System.out.println(""+a+b);
        System.out.println(a+b+"");
    }
}

When "" is at the front of a number operation, the following number operations will be added in the form of a character string.
When "" is at the end of a number, although the output result is still a character string, the output is the result of a+b operation

operation result:
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45361567/article/details/112602127