string.format用法

2024-11-23 03:14:00

1、打开Intellij软件,编写一个测试的类。

string.format用法

3、使用String.format(String format, Object... args)方法可以实现字符串拼接的功能。其中,使用%作为后面参数的占位符,%s表示字符串,%d表示数字。

string.format用法

5、因为format使用%作为占位符,所以如果要显示%,需要使用%%转义。

string.format用法
猜你喜欢