返回列表 發帖

printf() 函式 (二)

printf()函式輸出練習:
%d 整數
%s 字串
%S 轉換為大寫字母的字串

  1. public class Ch65
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼
May

  1. public class Ch65
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class Ch04
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class SDAWD {
  2.         public static void main(String[] args) {
  3.                 String s1="dog",s2="cat";
  4.             int a=3,b=5;
  5.             System.out.printf("There are %d %ss and %d %Ss",a,s1,b,s2);
  6.         }
  7. }
複製代碼

TOP

  1. public class Ch01
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class Ch01
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class Ch01
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class Ch02
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class Ch01
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class B
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

  1. public class Dfgh
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         String str1="dog", str2="cat";
  6.         int a=3, b=5;
  7.         System.out.printf("There are %d %ss and %d %Ss.",a,str1,b,str2);
  8.     }
  9. }
複製代碼

TOP

返回列表