History tsaiwn@csie.nctu.edu.tw 1967 BCPL, by Martin Richards 1970 B, modified from BCPL, by Ken Thompson, at Bell Lab. *1972 C, modified from B, by Dennis Ritchie, at Bell Lab. 1978 "The C Programming Language, 1st ed.," by Kernighan and Ritchie (K&R) *1980 C with classes (class 源自 SIMULA), by Bjarne Stroustrup, at Bell Lab. 1983 ANSI X3J11 comittee working for C Standard *1984 C with classes 改名為 C++ 1985 AT&T 開始對外發行 C++ 1.0 (Translator) 1988 K&R second edition published *1989/December ANSI C via ANSI X3J11 1990 ANSI X3J16 comittee working for C++ Standard *1991 OAK, based on C++, by James Gosling, at Sun Microsystems (目標是a Language for 家電用品, the Green project, but failed) 1993 OAK 死而復活 (因為 WWW 的流行), 後來改名 Java *1995/May Java formally announced by Sun Microsystems, with JDK 1.0 1996 IDL(Interface Definition Language), RMI (Remote Method Invocation), Java Beans, JDBC (Java DataBase Connectivity) 1997 JDK 1.1, Servlet *1998 ANSI C++ via ANSI X3J16 *1998/November Java 2 (JDK 1.2) *1999/June JDK 1.2.2 *1999/Oct JDK 1.3 1999 ANSI C99 (the latest version of C Standard, no compiler yet) *2001 JDK 1.3.1 *2002 JDK 1.4 *2004 JDK 1.5 (JDK 5.0) *2006 JDK 6.0 (JDK1.6) *2009 JDK 7.0 === JAVA JAVA JAVA JAVA JAVA === === JAVA JAVA JAVA JAVA JAVA JAVA === * Removed Features from C++ - pointers (太危險! 從此不能再耍花招)(其實Java的Reference是C++的pointer) - unions, struct (不需要, 且其實 class 就是 struct) - multiple inheritance, operator overloading (容易搞錯, 不易懂) - prepocessing (因會使程式缺乏可讀性) - template (不過因一直有人要求該加入, JDK1.5 已加入 generic type) - coercions (尊重程式作者? 請用 cast) (不過expression中promotion仍可以) - destructors (要死就死, 何必囉唆:-)其實是不需要, 因有 Garbage Collection) - goto statements (破斧沉舟! 讓你死了想用 goto 的念頭:-) ** Added Features: - data types: 八大原始類別: boolean (1 bit), char (16 bit, Unicode) byte(8 bit), short(16 bit). int (32 bit), long (64 bit) float 和 double 都與 C/C++ 同 (32 bit, 64 bit, IEEE754) * array as objects (注意宣告 array 時只生出 reference) * String class (類似 C++ class library 中的 string class) - multi-level break (break 可帶有 Label, 這才使goto真的變沒必要) - Packages (把相關 class 集合一起, 方便管理) - Interfaces (彌補去除multiple inheritance的不足) - automatic Garbage collection (從此不用擔心 memory leaking) - multithread & Synchronization - Runtime type checking *** How Java programs work? - Java 寫的程式可以分成 Application, Applet, 以及 Servlet, 檔名以.java結尾 - Java 程式若夾在網頁內則為 JSP (類似 PHP 以及 微軟的 ASP) - .java 的程式要用 javac 命令 compile 成 ByteCode, 檔名為 .calss 結尾 - Bytecode可給真的Java CPU 執行, 或任何CPU上的Java虛擬機器執行 - Java虛擬機器是Java的 Interpreter(解譯程式), 通常是用 C 語言寫的 - javac 是 Java程式的 Compiler; java 是 Java 的虛擬機器(解譯器Interpreter) - Runtime Environment -- Java Interpreter (java) with lots of Java class Library PC 使用者請到 java.sun.com 抓, 建議先熟悉 Standard Edition Sun 使用者請在 Solaris 上執行, 不要在 Sun OS 4.x 建議在 /usr/local/jdk/.. 之下找 javac 和 java 或問系統管理者 -- Load, Verify, Execute, JIT (Just In Time compiler) -- native code Executable image compiler/linker, like gcj * Can Java program be compiled/linked to native exec prog? A: YES. Please use google.com to search GCJ project.