java的printf

没有找到与「java的printf」相关的内容

AI 回答 由 glm-4-flash 生成 · 仅供参考,请自行核实
1. 格式化输出
2. 使用占位符
3. 示例代码:

public class Main {
public static void main(String[] args) {
int a = 10;
double b = 3.14;
String c = "Hello";
System.out.printf("整数:%d\n", a);
System.out.printf("浮点数:%.2f\n", b);
System.out.printf("字符串:%s\n", c);
}
}

相关搜索