Java之StringFormat
作者:互联网
package Demo_1_22_String; public class StringFormat { public static void main(String[] args) { String name = "张三"; int age = 19; double score = 98.212343; // 格式化输出 String str = String.format("姓名:%s\n年龄:%d\n成绩:%5.2f", name, age, score); System.out.println(str); } }
标签:Java,name,age,StringFormat,score,public,String 来源: https://www.cnblogs.com/0099-ymsml/p/15833975.html