小编tra*_*boo的帖子

How is string concatenation working here?

How does string concatenation work here? As the return value is of type String here, so everything should be converted to string. But why is it printing "30Good3040morning" here, instead of "1020Good3040morning". Please Help.

class StringConcatinationWorking{
    public static void main(String ...args){
        String s1 = 10 + 20 + "Good" + 30 + 40 + "morning";
        System.out.println(s1);
    }
}
Run Code Online (Sandbox Code Playgroud)

java string string-concatenation

0
推荐指数
1
解决办法
69
查看次数

标签 统计

java ×1

string ×1

string-concatenation ×1