Java 入門指南 - EncryptDemo.java




EncryptDemo.java 的程式原始碼如下

public class EncryptDemo {
    public static void main(String[] args) {
        System.out.println();
        
        String s[] = {"There is no spoon.",
                      "It is all around us.",
                      "Free your mind.",
                      "Follow the white rabbit.",
                      "Choice. The problem is choice.",
                      "Action, reaction. Cause, effect.",
                      "Everything that has a beginning has an end.",
                      "Because I choose to."};        
        encryptor.Encrypt e = new encryptor.Encrypt();
        String t = "";
        for (int i = 0; i < 8; i++) {
            t = e.toEncode(s[i]);
            System.out.println(t);
            t = e.toDecode(t);
            System.out.println(t);
        }
         
        System.out.println();
    }
}

/* 《程式語言教學誌》的範例程式
    http://pydoing.blogspot.com/
    檔名:EncryptDemo.java
    功能:示範 Java 程式 
    作者:張凱慶
    時間:西元 2011 年 4 月 */


您可以繼續參考
範例程式碼


相關目錄
回 Java 入門指南
回 Java 教材目錄
回首頁


參考資料
The JavaTM Tutorials: Getting Started
The JavaTM Tutorials: Learning the Java Language
The JavaTM Tutorials: Essential Classes
The Java Language Specification, Third Edition


本文於 2013 年 1 月訂正

沒有留言: