返回列表 發帖
  1. public class ch63
  2. {
  3.      public static void main(String args[])
  4.      {
  5.          String a="There are %d cats and %d dogs.%n";
  6.          String b="There are %f cats and %.2f dogs.%n";
  7.          String c="There are %s cats and %d dogs,%s pigs,and %d rabbits.%n";
  8.          System.out.printf(a,5,7);
  9.          System.out.printf(b,5.0,7.0);
  10.          System.out.printf(c,"5",7,"2",3);
  11.      }
  12. }
複製代碼

TOP

返回列表