使用%s占位,使用String.format转换

    public class Test {
        public static void main(String[] args) {
            String a1 = "a1";
            String a2 = "a2";
            String url = String.format("this is %s,this is %s", a1, a2);
            System.out.println(url);
        }
    }

控制台输出
this is a1,this is a2

相关文章:

  • 2021-12-01
  • 2022-12-23
  • 2021-10-02
  • 2022-02-26
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-26
  • 2021-12-26
  • 2021-10-10
  • 2022-12-23
  • 2022-03-03
相关资源
相似解决方案