關(guān)于我們
書單推薦
新書推薦
|
Java程序設(shè)計(jì)與應(yīng)用 讀者對象:本書既可以作為高等院校各專業(yè)的基礎(chǔ)教材,也可以作為使用Java的工程技術(shù)人員和科技工作者的自學(xué)參考書。
本書介紹了Java 程序設(shè)計(jì)的基礎(chǔ)知識及其編程方法,包括Java 編程基礎(chǔ)、面向?qū)ο蟮乃枷爰案拍、常見字符串與類的使用、Java 的集合框架、文件和數(shù)據(jù)流、數(shù)據(jù)庫、GUI 及事件響應(yīng)、多線程和Java 網(wǎng)絡(luò)編程等內(nèi)容。本書以通俗易懂的語言介紹了Java 面向?qū)ο缶幊痰乃枷牒途幊碳记桑瑑?nèi)容豐富,結(jié)構(gòu)合理,并且提供了豐富的例程。本書既可以作為高等院校各專業(yè)的基礎(chǔ)教材,也可以作為使用Java 的工程技術(shù)人員和科技工作者的自學(xué)參考書。
郭俊,男,成都理工大學(xué)工程技術(shù)學(xué)院副教授。從事方向?yàn)橛?jì)算機(jī)應(yīng)用、信息技術(shù)教學(xué)。擔(dān)任四川省普通高校應(yīng)用型本科示范課程建設(shè)項(xiàng)目"面向?qū)ο缶幊獭闭n程負(fù)責(zé)人,成都理工大學(xué)工程技術(shù)學(xué)院精品在線課程"面向?qū)ο缶幊獭闭n程負(fù)責(zé)人。
目 錄
第1 章 Java 概述························································································1 1.1 Java 的產(chǎn)生與發(fā)展···········································································1 1.2 Java 的特點(diǎn)·····················································································1 1.3 JVM 虛擬機(jī)····················································································2 1.4 垃圾回收機(jī)制··················································································3 1.5 Java 開發(fā)環(huán)境··················································································3 1.5.1 什么是JDK ···········································································3 1.5.2 JDK 的安裝設(shè)置·····································································3 1.5.3 JDK 目錄介紹········································································6 1.6 第一個Java 程序··············································································6 1.6.1 命令行方式···········································································6 1.6.2 使用Eclipse 集成開發(fā)環(huán)境························································7 1.7 Java 編程規(guī)范···············································································.10 1.8 上機(jī)實(shí)驗(yàn)·····················································································.10 1.9 本章小結(jié)·····················································································.11 習(xí)題·································································································.11 第2 章 Java 語言基礎(chǔ)···············································································.12 2.1 基礎(chǔ)語法·····················································································.12 2.1.1 標(biāo)識符··············································································.12 2.1.2 關(guān)鍵字··············································································.12 2.2 數(shù)據(jù)類型·····················································································.12 2.2.1 基本數(shù)據(jù)類型·····································································.13 2.2.2 變量的類型轉(zhuǎn)換··································································.15 2.3 Java 中的運(yùn)算符············································································.15 2.3.1 算術(shù)運(yùn)算符········································································.16 2.3.2 賦值運(yùn)算符········································································.17 2.3.3 關(guān)系運(yùn)算符········································································.17 2.3.4 邏輯運(yùn)算符········································································.18 2.3.5 位運(yùn)算符···········································································.18 2.3.6 運(yùn)算符的優(yōu)先級··································································.19 ·VI · 2.4 流程控制·····················································································.19 2.4.1 順序結(jié)構(gòu)···········································································.20 2.4.2 選擇結(jié)構(gòu)···········································································.20 2.4.3 循環(huán)結(jié)構(gòu)···········································································.24 2.4.4 跳轉(zhuǎn)語句···········································································.27 2.5 數(shù)組···························································································.28 2.5.1 數(shù)組的概念········································································.28 2.5.2 二維數(shù)組···········································································.31 2.6 上機(jī)實(shí)驗(yàn)·····················································································.33 2.7 本章小結(jié)·····················································································.35 習(xí)題·································································································.35 第3 章面向?qū)ο?·····················································································.36 3.1 面向?qū)ο蟮母拍睢ぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁ?36 3.2 類與對象·····················································································.36 3.2.1 類和對象···········································································.36 3.2.2 類的定義···········································································.37 3.2.3 對象的創(chuàng)建和使用·······························································.38 3.2.4 構(gòu)造方法···········································································.40 3.2.5 this 關(guān)鍵字·········································································.42 3.3 參數(shù)傳值·····················································································.44 3.4 static 關(guān)鍵字·················································································.45 3.5 基本類型的包裝類·········································································.47 3.6 認(rèn)識異!ぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁ.48 3.6.1 異常的概念········································································.48 3.6.2 異常的分類········································································.50 3.6.3 異常處理機(jī)制·····································································.51 3.6.4 finally 語句·········································································.51 3.6.5 throws 語句·········································································.53 3.6.6 throw 語句··········································································.53 3.6.7 自定義異!ぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁ.54 3.7 上機(jī)實(shí)驗(yàn)·····················································································.55 3.8 本章小結(jié)·····················································································.57 習(xí)題·································································································.57 第4 章繼承 ···························································································.58 4.1 繼承的概念(子類與父類) ····························································.58 4.2 子類對象的創(chuàng)建············································································.59 4.3 繼承的原則··················································································.60 ·VII· 4.4 成員變量的隱藏和方法重寫····························································.60 4.4.1 成員變量的隱藏··································································.60 4.4.2 方法的重寫(Override)························································.60 4.5 super 關(guān)鍵字················································································.62 4.6 final 關(guān)鍵字·················································································.64 4.7 方法重載與多態(tài)············································································.65 4.7.1 方法的重載········································································.65 4.7.2 多態(tài)的用法········································································.66 4.8 包······························································································.68 4.9 訪問權(quán)限控制···············································································.68 4.9.1 私有變量和私有方法····························································.69 4.9.2 公共變量和公共方法····························································.69 4.9.3 受保護(hù)的成員變量和成員方法················································.69 4.9.4 友好的成員變量和成員方法···················································.70 4.9.5 訪問級別控制·····································································.70 4.10 上機(jī)實(shí)驗(yàn)···················································································.70 4.11 本章小結(jié)···················································································.72 習(xí)題·································································································.72 第5 章抽象類與接口 ···············································································.75 5.1 抽象類與抽象方法·········································································.75 5.2 接口的概念與實(shí)現(xiàn)·········································································.76 5.3 接口回調(diào)·····················································································.78 5.4 接口與多態(tài)··················································································.80 5.5 接口與抽象類的比較······································································.81 5.6 上機(jī)實(shí)驗(yàn)·····················································································.82 5.7 本章小結(jié)·····················································································.82 習(xí)題·································································································.82 第6 章內(nèi)部類 ························································································.85 6.1 內(nèi)部類的創(chuàng)建和使用······································································.85 6.2 內(nèi)部類的作用···············································································.86 6.3 內(nèi)部類的分類···············································································.90 6.3.1 匿名內(nèi)部類········································································.90 6.3.2 局部內(nèi)部類········································································.91 6.3.3 靜態(tài)內(nèi)部類········································································.92 6.4 上機(jī)實(shí)驗(yàn)·····················································································.93 6.5 本章小結(jié)·····················································································.94 習(xí)題·································································································.94 ·VI II· 第 7 章字符串與常用類 ············································································.97 7.1 字符串························································································.97 7.1.1 String 構(gòu)造函數(shù)···································································.97 7.1.2 字符串的常用方法·······························································.98 7.1.3 字符串應(yīng)用示例··································································.98 7.1.4 JDK 的幫助文檔··································································.99 7.2 字符串解析··················································································102 7.2.1 正則表達(dá)式········································································102 7.2.2 Patterm 類和Matcher 類·························································103 7.3 StringBuffer 類和StringBuilder 類······················································105 7.4 常用類························································································107 7.4.1 Math 類·············································································107 7.4.2 Random 類··········································································108 7.4.3 Date 類和Calendar 類····························································109 7.4.4 DateFormat 類和SimpleDateFormat 類·······································110 7.5 上機(jī)實(shí)驗(yàn)·····················································································111 7.6 本章小結(jié)·····················································································112 習(xí)題·································································································112 第8 章集合與泛型 ··················································································113 8.1 集合框架概述···············································································113 8.2 List 接口·····················································································113 8.2.1 List 接口簡介······································································113 8.2.2 Iterator 接口········································································117 8.3 Set 接口······················································································118 8.3.1 Set 接口簡介·······································································118 8.3.2 HashSet 集合·······································································118 8.3.3 TreeSet 集合·······································································121 8.4 Map 接口····················································································121 8.4.1 HashMap 類········································································122 8.4.2 Properties 類·······································································123 8.5 泛型···························································································124 8.5.1 泛型集合···········································································125 8.5.2 使用泛型類聲明對象····························································126 8.6 上機(jī)實(shí)驗(yàn)·····················································································127 8.7 本章小結(jié)·····················································································128 習(xí)題·································································································128 ·IX· 第 9 章輸入輸出流 ··················································································130 9.1 文件類························································································130 9.1.1 創(chuàng)建File 類對象··································································130 9.1.2 獲取文件或目錄的信息·························································130 9.2 字節(jié)流和字符流············································································132 9.2.1 字節(jié)流··············································································133 9.2.2 字符流··············································································135 9.3 文件流························································································137 9.3.1 FileInputStream 類和FileOutputStream 類···································138 9.3.2 文件字符流········································································140 9.4 緩沖流························································································142 9.4.1 字節(jié)緩沖流········································································142 9.4.2 字符緩沖流········································································144 9.5 轉(zhuǎn)換流························································································145 9.6 隨機(jī)讀寫文件類············································································146 9.7 上機(jī)實(shí)驗(yàn)·····················································································148 9.8 本章小結(jié)·····················································································149 習(xí)題·································································································149 第10 章圖形用戶界面 ··············································································150 10.1 Java Swing 概述···········································································150 10.2 Swing 容器·················································································150 10.2.1 JFrame 容器······································································152 10.2.2 對話框·············································································153 10.2.3 JPanel 面板·······································································155 10.3 布局管理器················································································156 10.3.1 BorderLayout 布局管理器·····················································156 10.3.2 FlowLayout 布局管理器·······················································157 10.3.3 GridLayout 布局管理器························································159 10.4 事件處理···················································································160 10.4.1 事件處理模型····································································160 10.4.2 事件類·············································································162 10.4.3 適配器類··········································································165 10.5 Swing 組件·················································································165 10.5.1 文本組件··········································································166 10.5.2 按鈕組件··········································································169 10.6 菜單組件···················································································174 10.6.1 下拉菜單··········································································174 ·X· 10.6.2 彈出式菜單·······································································175 10.7 上機(jī)實(shí)驗(yàn)···················································································177 10.8 本章小結(jié)···················································································177 習(xí)題·································································································178 第11 章JDBC 編程··················································································179 11.1 JDBC 概述·················································································179 11.2 JDBC 常用的接口和類··································································180 11.2.1 Driver 類··········································································180 11.2.2 DriverManager 類································································181 11.2.3 Connection 接口·································································183 11.2.4 Statement 接口···································································183 11.2.5 PreparedStatement 接口·························································184 11.2.6 ResultSet 接口····································································185 11.3 JDBC 程序示例···········································································186 11.4 數(shù)據(jù)庫的基本操作·······································································191 11.5 事務(wù)處理···················································································193 11.5.1 事務(wù)概述··········································································193 11.5.2 JDBC 處理事務(wù)··································································194 11.6 上機(jī)實(shí)驗(yàn)···················································································197 11.7 本章小結(jié)···················································································197 習(xí)題·································································································198 第12 章Java 多線程················································································200 12.1 線程概述···················································································200 12.1.1 進(jìn)程················································································200 12.1.2 線程················································································201 12.2 創(chuàng)建線程···················································································202 12.2.1 繼承Thread 類···································································202 12.2.2 實(shí)現(xiàn)Runnable 接口·····························································205 12.2.3 兩種實(shí)現(xiàn)多線程方式的區(qū)別··················································206 12.3 Java 中的線程·············································································209 12.3.1 線程的生命周期·································································209 12.3.2 線程調(diào)度與優(yōu)先級······························································214 12.4 線程的同步················································································216 12.4.1 同步代碼塊·······································································216 12.4.2 同步方法··········································································219 12.4.3 死鎖················································································220 12.5 線程交互···················································································224 ·XI· 12.6 上機(jī)實(shí)驗(yàn)···················································································228 12.7 本章小結(jié)···················································································228 習(xí)題·································································································228 第13 章網(wǎng)絡(luò)編程 ····················································································231 13.1 URL ·························································································231 13.1.1 URL 的構(gòu)造方法································································231 13.1.2 獲取URL 中的資源····························································232 13.2 InetAddress 類·············································································233 13.3 TCP 網(wǎng)絡(luò)編程·············································································235 13.3.1 ServerSocket 類··································································235 13.3.2 Socket 類··········································································237 13.3.3 多線程的TCP 網(wǎng)絡(luò)編程·······················································239 13.4 UDP 編程··················································································243 13.4.1 DatagramPacket 類······························································243 13.4.2 DatagramSocket 類······························································244 13.4.3 UDP 網(wǎng)絡(luò)編程···································································245 13.5 廣播數(shù)據(jù)報(bào)················································································247 13.6 上機(jī)實(shí)驗(yàn)···················································································250 13.7 本章小結(jié)···················································································250 習(xí)題·································································································250 參考文獻(xiàn)··································································································253
你還可能感興趣
我要評論
|