1+2+" result " 与 "result "+1+2 赋值给String变量结果

来源:互联网 发布:python数字识别 编辑:程序博客网 时间:2024/06/05 07:04

public class StringTest{
 public static void main(String args[]){
  String s1 = 1 + 2 + "  result ";
  String s2 = "result " + 1 + 2;
  System.out.println("s1: " + s1);
  System.out.println("s2: " + s2);
 }
}

结果:s1: 3  result 
           s2: result 12

原创粉丝点击