?Java?,????printf????????????????????????:
- ?????:
int num = 10; System.out.printf("??:%d\n", num);
- ??????:
double num = 10.5; System.out.printf("???:%.2f\n", num);
- ??????:
String str = "Hello"; System.out.printf("???:%s\n", str);
- ???????:
int num1 = 10; double num2 = 10.5; String str = "Hello"; System.out.printf("??:%d,???:%.2f,???:%s\n", num1, num2, str);
- ???????????:
int num = 10; System.out.printf("???5,???:]\n", num); System.out.printf("???5,???:%-5d\n", num);
???????????????,????printf???????????,????????????