书籍详情
JAVA程序设计与问题解决:高级篇(英文版.第4版)
作者:(美)萨维奇 著
出版社:人民邮电出版社
出版时间:2006-12-01
ISBN:9787115152893
定价:¥59.00
购买这本书可以去
内容简介
本书是国外高校采用率很高的Java程序设计的经典教材。书中不但讲解Java的知识还提供了一些编程技巧。书的内容包括异常处理、流和文件I/O、动态数据结构与泛型、递归等高级主题。本书使用了J2SE 5.0的最新特性,并且包含新的、可选讲的图形编程内容和贯穿全书的GUI补充知识。.本书可作为高等院校计算机专业本科生或研究生Java语言程序设计课程的教材,也适合相关技术人员作为技术提高之用。本书是一部享有盛誉的Java教程,已被全球包括哈佛大学、普度大学、得克萨斯大学奥斯汀分校、密歇根大学、加州大学洛杉矶分校等名校在内的200多所高校采用为教材。..书中作者在讲授Java程序设计语言基础知识的同时,还将问题求解的技能、编程技巧和良好的编程实践融会其中。流畅易读的语言,透彻清晰的叙述,精心编排的版式和内容,充分体现了作者数十年计算机语言教学的经验和功力。新版覆盖了Java 5.0,而且包含了可选讲的图形编程内容。书中包含丰富的自测题、编程技巧提示、编程项目和常见编程错误,而且内容组织方式非常灵活,可以根据实际教学需要调整授课内容和讲授顺序,适合各种教学方式,也是极好的自学教程。...
作者简介
作者:Walter SavitchWalter Savitch加州大学圣迭戈分校退休教授。1960年于加州大学伯克利分校获得博士学位,曾担任加州大学圣迭戈分校计算机科学系教授和认知科学跨学科博士项目主任。他在复杂性理论和并行计算模型方面做出了重要贡献,研究领域还包括形式语言理论、计算语言学等。除本书外,他著有一系列编程语言教材,都广受欢迎,畅销不衰,被誉为读者最多的计算机编程语言图书作者。...
目录
CHAPTER 8Exception Handling569
Objectives570
Prerequisites570
8.1Basic Exception Handling571
Exceptions in Java571
Predefined Exception Classes583
ArrayIndex0ut0fBoundsException (Alternative Ordering)584
8.2Defining Exception Classes585
Defining Your Own Exception Classes585
Programming Tip: When to Define an Exception Class591
8.3Using Exception Classes596
Declaring Exceptions (Passing the Buck)596
Exceptions That Do Not Need To Be Caught600
The Assertion Error Class (Optional)601
Multiple Throws and Catches601
Programming Tip: Exception Handling and Information Hiding605
Programming Tip: When to Throw an Exception607
The final1y Block (Optional)609
Rethrowing an Exception (Optional)610
Case Study: A Line-0riented Calculator611
8.4Graphics Supplement (Optional)625
Exceptions in GUls625
Programming Example: A JFrame Using Exceptions626
Chapter Summary630
Answers to Self-Test Questions630
Programming Projects635
CHAPTER 9Streams and File I/O641
Objectives642
Prerequisites642
9.1An Overview of Streams and File I/O343
The Concept of a Stream643
Why Use Files for I/0?643
Differences between Text Files and Binary Files643
9.2Text-File I/O645
Text-File Output with PrintWriter645
Text-File Input with BufferedReader656
Programming Example: Reading a File Name from the Keyboard660
The StringTokenizer Class663
The Classes Fi1eReader and File0utputStream667
9.3The Fi1e Class669
Using the File Class669
9.4Basic Binary-File I/O672
Output to Binary Files, Using ObjectOutputStream673
Some Details about write UTF (Optional)678
Reading Input from a Binary File, Using ObjectInputStream679
The E0FException Class685
The Classes Fi1elnputStream and Fi1eOutputStream688
Programming Example: Processing a File of Binary Data689
9.5Object I/O with Object Streams393
Binary I/0 of Class Objects693
The Serializable Interface698
Array Objects in Binary Files699
9.6Graphics Supplement (Optional)701
Programming Example: A JFrame GUI for Manipulating Files701
Chapter Summary707
Answers to Self-Test Questions707
Programming Projects713
CHAPTER 10 Dynamic Data Structures and Generics717
Objectives718
Prerequisites718
10.1 Vectors719
Using Vectors719
Programming Tip: Adding to a Vector726
Parameterized Classes and Generics732
10.2 Linked Data Structures733
Linked Lists733
Inner Classes744
Node Inner Classes745
Iterators746
Programming Tip: Internal and External Iterators759
Exception Handling with Linked Lists759
Variations on a Linked List763
Other Linked Data Structures765
10.3 Generics765
Generic Basics766
Programming Example: A Generic Linked List768
Chapter Summary774
Answers to Self-Test Questions774
Programming Projects783
CHAPTER 11 Recursion787
Objectives788
Prerequisites788
11.1 The Basics of Recursion788
Case Study: Digits to Words789
How Recursion Works794
Recursive versus Iterative Definitions801
Recursive Methods That Return a Value801
11.2 Programming with Recursion806
Programming Tip: Ask Until the User Gets It Right806
Case Study: Binary Search808
Programming Tip: Generalize the Problem812
Programming Example: Merge Sort——A Recursive Sorting Method816
Chapter Summary821
Answers to Self-Test Questions821
Programming Projects823
CHAPTER 12Window Interfaces Using Swing827
Objectives828
Prerequisites828
12.1Background829
Guls——Graphical User Interfaces829
Event-Driven Programming829
12.2Basic Swing Details831
Programming Example: A Simple Window832
More about Window Listeners838
Size Units for Screen Objects840
More on setVisible841
Programming Example: A Better Version of Our First Swing Program843
Programming Example: A Window with Color846
Some Methods of the Class 3 Frame850
Layout Managers853
12.3Buttons and Action Listeners860
Programming Example: Adding Buttons860
Buttons862
Action Listeners and Action Events864
Interfaces869
The Model-View-Controller Pattern871
12.4Container Classes874
The JPanel Class874
12.5The Container Class877
12.6Text I/O for GUIs882
Text Areas and Text Fields882
Programming Example: Labeling a Text Field888
Inputting and Outputting Numbers890
Programming Example: A GUI Adding Machine893
Catching a NumberFormatExcepti on897
Chapter Summary900
Answers to Self-Test Questions901
Programming Projects909
CHAPTER 13Applets and HTML913
Objectives914
Prerequisites914
13.1Applets915
Applet Basics915
Running an Applet918
Programming Example: An Adder Applet918
Adding Icons to an Applet921
13.2Introduction to HTML924
HTML Basics924
Programming Tip: A Simple HTML-Document Outline926
Inserting Hyperlinks926
Displaying a Picture931
Programming Tip: HTML Is a Low-Level Language932
13.3Applets in HTML932
Placing an Applet in an HTML Document932
The Older Applet Class (Optional)935
Applets and Security936
Chapter Summary937
Answers to Self-Test Questions937
Programming Projects938
CHAPTER 14More Swing941
Objectives942
Prerequisites942
14.1Menus942
Programming Example: A GUI with a Menu943
Menu Bars, Menus, and Menu Items943
Nested Menus948
14.2Making GUIs Pretty (and More Functional)950
Adding Icons950
The JScroll Pane Class for Scroll Bars957
Adding Borders963
14.3More Layout Managers969
The Box Layout Manager Class969
Struts and Glue973
Setting the Spacing between Components975
The Box Container Class975
The Card Layout Manager978
14.4Inner Classes984
Helping Classes984
14.5More on Events and Listeners986
The Windowkistener Interface986
Programming Example: Components with Changing Visibility997
Some More Details on Updating a GUI1000
14.6Another Look at the Swing Class Hierarchy1001
Buttons, Menus, and Abstract Buttons1001
Chapter Summary1004
Answers to Self-Test QuestionslOO4
Programming Projects1008
Objectives570
Prerequisites570
8.1Basic Exception Handling571
Exceptions in Java571
Predefined Exception Classes583
ArrayIndex0ut0fBoundsException (Alternative Ordering)584
8.2Defining Exception Classes585
Defining Your Own Exception Classes585
Programming Tip: When to Define an Exception Class591
8.3Using Exception Classes596
Declaring Exceptions (Passing the Buck)596
Exceptions That Do Not Need To Be Caught600
The Assertion Error Class (Optional)601
Multiple Throws and Catches601
Programming Tip: Exception Handling and Information Hiding605
Programming Tip: When to Throw an Exception607
The final1y Block (Optional)609
Rethrowing an Exception (Optional)610
Case Study: A Line-0riented Calculator611
8.4Graphics Supplement (Optional)625
Exceptions in GUls625
Programming Example: A JFrame Using Exceptions626
Chapter Summary630
Answers to Self-Test Questions630
Programming Projects635
CHAPTER 9Streams and File I/O641
Objectives642
Prerequisites642
9.1An Overview of Streams and File I/O343
The Concept of a Stream643
Why Use Files for I/0?643
Differences between Text Files and Binary Files643
9.2Text-File I/O645
Text-File Output with PrintWriter645
Text-File Input with BufferedReader656
Programming Example: Reading a File Name from the Keyboard660
The StringTokenizer Class663
The Classes Fi1eReader and File0utputStream667
9.3The Fi1e Class669
Using the File Class669
9.4Basic Binary-File I/O672
Output to Binary Files, Using ObjectOutputStream673
Some Details about write UTF (Optional)678
Reading Input from a Binary File, Using ObjectInputStream679
The E0FException Class685
The Classes Fi1elnputStream and Fi1eOutputStream688
Programming Example: Processing a File of Binary Data689
9.5Object I/O with Object Streams393
Binary I/0 of Class Objects693
The Serializable Interface698
Array Objects in Binary Files699
9.6Graphics Supplement (Optional)701
Programming Example: A JFrame GUI for Manipulating Files701
Chapter Summary707
Answers to Self-Test Questions707
Programming Projects713
CHAPTER 10 Dynamic Data Structures and Generics717
Objectives718
Prerequisites718
10.1 Vectors719
Using Vectors719
Programming Tip: Adding to a Vector726
Parameterized Classes and Generics732
10.2 Linked Data Structures733
Linked Lists733
Inner Classes744
Node Inner Classes745
Iterators746
Programming Tip: Internal and External Iterators759
Exception Handling with Linked Lists759
Variations on a Linked List763
Other Linked Data Structures765
10.3 Generics765
Generic Basics766
Programming Example: A Generic Linked List768
Chapter Summary774
Answers to Self-Test Questions774
Programming Projects783
CHAPTER 11 Recursion787
Objectives788
Prerequisites788
11.1 The Basics of Recursion788
Case Study: Digits to Words789
How Recursion Works794
Recursive versus Iterative Definitions801
Recursive Methods That Return a Value801
11.2 Programming with Recursion806
Programming Tip: Ask Until the User Gets It Right806
Case Study: Binary Search808
Programming Tip: Generalize the Problem812
Programming Example: Merge Sort——A Recursive Sorting Method816
Chapter Summary821
Answers to Self-Test Questions821
Programming Projects823
CHAPTER 12Window Interfaces Using Swing827
Objectives828
Prerequisites828
12.1Background829
Guls——Graphical User Interfaces829
Event-Driven Programming829
12.2Basic Swing Details831
Programming Example: A Simple Window832
More about Window Listeners838
Size Units for Screen Objects840
More on setVisible841
Programming Example: A Better Version of Our First Swing Program843
Programming Example: A Window with Color846
Some Methods of the Class 3 Frame850
Layout Managers853
12.3Buttons and Action Listeners860
Programming Example: Adding Buttons860
Buttons862
Action Listeners and Action Events864
Interfaces869
The Model-View-Controller Pattern871
12.4Container Classes874
The JPanel Class874
12.5The Container Class877
12.6Text I/O for GUIs882
Text Areas and Text Fields882
Programming Example: Labeling a Text Field888
Inputting and Outputting Numbers890
Programming Example: A GUI Adding Machine893
Catching a NumberFormatExcepti on897
Chapter Summary900
Answers to Self-Test Questions901
Programming Projects909
CHAPTER 13Applets and HTML913
Objectives914
Prerequisites914
13.1Applets915
Applet Basics915
Running an Applet918
Programming Example: An Adder Applet918
Adding Icons to an Applet921
13.2Introduction to HTML924
HTML Basics924
Programming Tip: A Simple HTML-Document Outline926
Inserting Hyperlinks926
Displaying a Picture931
Programming Tip: HTML Is a Low-Level Language932
13.3Applets in HTML932
Placing an Applet in an HTML Document932
The Older Applet Class (Optional)935
Applets and Security936
Chapter Summary937
Answers to Self-Test Questions937
Programming Projects938
CHAPTER 14More Swing941
Objectives942
Prerequisites942
14.1Menus942
Programming Example: A GUI with a Menu943
Menu Bars, Menus, and Menu Items943
Nested Menus948
14.2Making GUIs Pretty (and More Functional)950
Adding Icons950
The JScroll Pane Class for Scroll Bars957
Adding Borders963
14.3More Layout Managers969
The Box Layout Manager Class969
Struts and Glue973
Setting the Spacing between Components975
The Box Container Class975
The Card Layout Manager978
14.4Inner Classes984
Helping Classes984
14.5More on Events and Listeners986
The Windowkistener Interface986
Programming Example: Components with Changing Visibility997
Some More Details on Updating a GUI1000
14.6Another Look at the Swing Class Hierarchy1001
Buttons, Menus, and Abstract Buttons1001
Chapter Summary1004
Answers to Self-Test QuestionslOO4
Programming Projects1008
猜您喜欢