字符串连接符

字符串连接符用“+”表示;

    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        //""在前面就代表是字符串连接符
        System.out.println(""+a+b);
        //""在后面就会先计算数值,相当于连接一个空字符串
        System.out.println(a+b+"");
    }

结果:

1020
30

原文地址:https://www.cnblogs.com/xie-qi/p/14018619.html