更新时间:2022-06-10 04:52:17
%d
用于整数使用%f
,它适用于 float
和 double
types:
%d
is for integers use %f
instead, it works for both float
and double
types:
double d = 1.2;
float f = 1.2f;
System.out.printf("%f %f",d,f); // prints 1.200000 1.200000