Java 入門指南 V2.00 - 單元 18 範例




APIDemo01.java


import java.util.Date;

public class APIDemo01 {
   public static void main(String[] args) {
      Date d = new Date();
      System.out.println(d);
   }
}
 
/* 檔名: APIDemo01.java
   作者: Kaiching Chang
   時間: September, 2014  */

APIDemo02.java


public class APIDemo02 {
   public static void main(String[] args) {
      String s = "There is no spoon.";
      System.out.println(s);
      String s1 = s.replace("a", "e");
      System.out.println(s1);
      String s2 = s1.replace("e", "i");
      System.out.println(s2);
      String s3 = s2.replace("i", "o");
      System.out.println(s3);
      String s4 = s3.replace("o", "u");
      System.out.println(s4);
      String s5 = s4.replace("u", "a");
      System.out.println(s5);
   }
}
 
/* 檔名: APIDemo02.java
   作者: Kaiching Chang
   時間: September, 2014  */

the end

沒有留言: