JAVA 占位符%s的使用


使用%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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM