格式化不打印出值,而是返回0

时间:2018-10-27 00:28:14

标签: formatting

我也已经声明了所有变量,但是我不确定为什么它显示0

这是代码:

System.out.printf("| %10s | %10s | %10s | %10s | %15s| %15s |\n", "DC", noDC,df.format(tables.foodCost[0]), tables.foodWeight[0], df.format(tables.foodCost[0]*noDC), df.format(tables.foodWeight[0]*noDC/1000)+" kg");
        System.out.println("|------------|------------|------------|------------|----------------|-----------------|");
        totCost = totCost+tables.foodCost[0]*noDC;
        totWeight = totWeight+tables.foodWeight[0]*noDC;

0 个答案:

没有答案