TRUNG TÂM TIN HỌC
ĐẠI HỌC KHOA HỌC TỰ NHIÊN-TP.HCM
1
NHẬP MÔN LẬP TRÌNH JAVA
TRUNG TÂM TIN HỌC
ĐẠI HỌC KHOA HỌC TỰ NHIÊN-TP.HCM
Bài 1: Giới thiệu lập trình Java
1. Lịch sử JDK
2. Cài đặt JDK và IDE
Bài 1: Giới thiệu lập trình Java
3
Lịch sử Java
Java được viết bởi James Gosling vào
6/1991 trong dự án top box project
Ban đầu gọi là Oak
Được đổi tên thành Java 1.0 năm
1995
Khẩu hiệu "Write Once, Run
Anywhere" (WORA)
Phiên bản mới nhất J2SE.7 (Dolphin)
James A. Gosling
Bài 1: Giới thiệu lập trình Java
4
Phân loại
J2SE (Java 2 Standard Edition)
– Ứng dụng Desktop
J2EE (Java 2 Enterprise Edition)
– Ứng dụng Enterprise
J2ME (Java 2 Mobile Edition)
– Ứng dụng Mobile
Bài 1: Giới thiệu lập trình Java
5
Cài đặt Java 5
Tải java 5 từ www.java.sun.com
Thiết lập JAVA_HOME
Bài 1: Giới thiệu lập trình Java
6
Cài đặt IDE
Netbeans – version 6.0
– Tải từ: www.netbeans.org
JBuilder
JCreator
JEdit
Notepad
Bài 1: Giới thiệu lập trình Java
7
Thiết lập CLASSPATH
Bài 1: Giới thiệu lập trình Java
8
HelloWorld Application
1 // HelloWorld.java
2 // Printing multiple lines in a dialog box
3
4 // Java extension packages
5 import javax.swing.JOptionPane; // import class JOptionPane
6
7 public class HelloWorld {
8
9 // main method begins execution of Java application
10 public static void main( String args[] )
11 {
12 JOptionPane.showMessageDialog(
13 null, "Welcome\nto\nJava\nProgramming!" );
14
15 System.exit( 0 ); // terminate application
16
17 } // end method main
18
19 } // end class HelloWorld
Bài 1: Giới thiệu lập trình Java
9
HelloWorld 1 Application
1 // HelloWorld_1.java
2 // Printing multiple lines in console
3
4 public class HelloWorld _1{
5
6 // main method begins execution of Java application
7 public static void main( String args[] )
8 {
9
10 System.out.println(“Welcome\nto\nJava\nProgramming!”);
11
12
13 } // end method main
14
15 } // end class HelloWorld_1