如果想用零垫打印这个方法怎么做呢
int month,day; public void printNumeric() { System.out.printf("month +"/" +day +" \n"); // i would like the month if it is 5 to be 05 same thing with the day }
解决方法
int month,day; public void printNumeric() { System.out.printf("%02d/%02d\n",month,day); // i would like the month if it is 5 to be 05 same thing with the day }