"%1.2f"
System.out.println("\nYou should eat ");
System.out.printf ("%1.2f", mChoc);
System.out.println(" chocolate bars if you are male to maintain your weight!");
System.out.println("You should eat");
System.out.printf("%.2f", fChoc);
System.out.println(" chocolate bars if you are female to maintain your weight!");
答案 0 :(得分:3)
使用iOS 10
代替print
(第二个添加换行符),或您可以使用一个调用,如
println