core java目录_第1页
core java目录_第2页
core java目录_第3页
core java目录_第4页
core java目录_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第一章 Java的起源第二章 Java语言概述第三章 数据类型、变量、数组第四章 运算符第五章 程序控制语句第六章 介绍类第七章 进一步研究方法和类第八章 继承第九章 包和接口第十章 异常处理第十一章 多线程编程第十二章 输入/输出、小应用程序和其他主题第十三章 字符串处理第十四章 java.lang研究第十五章 java.util第1部分:类集结构第十六章 java.util第2部分:更多的实用工具类第十七章 输入/输出:探索java.io第十八章 网络第十九章 Applet类第二十章 事件处理第二十一章 介绍AWT:使用窗口、图形、文本第 二十二章 使用AWT空间、布局管理器和菜单第二十三

2、章 图像第二十四章 附加的包第二十五章 Java Beans第二十六章 Swing第二十七章 从C+到Java第二十八章 DynamicBillboard小应用程序第二十九章 ImageMenu:一个基于图像的Web菜单第三十章 Lavatron小应用程序:运动竞技场的显示牌第三十一章 Scrabblet:多玩家的猜字游戏Java核心技术 卷I:基础知识(第9版·英文版)(上、下册) Prefacev Acknowledgmentsix Chapter 1: An Introduction to Java1 1.1Java As a Progr

3、amming Platform1 1.2The Java “White Paper” Buzzwords2 1.2.1Simple3 1.2.2Object-Oriented4 1.2.3Network-Savvy4 1.2.4Robust5 1.2.5Secure5 1.2.6Architecture-Neutral6 1.2.7Portable7 1.2.8Interpreted7 1.2.9High-Performance8 1.2.10Multithreaded8 1

4、.2.11Dynamic8 1.3Java Applets and the Internet9 1.4A Short History of Java10 1.5Common Misconceptions about Java13 Chapter 2: The Java Programming Environment17 2.1Installing the Java Development Kit18 2.1.1Downloading the JDK18 2.1.2Setting the Executable Path20&#

5、160;2.1.3Installing the Library Source and Documentation22 2.1.4Installing the Core Java Program Examples23 2.1.5Navigating the Java Directories24 2.2Choosing a Development Environment24 2.3Using the Command-Line Tools25 2.3.1Troubleshooting Hints27 2.4Using an Integrat

6、ed Development Environment28 2.4.1Locating Compilation Errors32 2.5Running a Graphical Application33 2.6Building and Running Applets36 Chapter 3: Fundamental Programming Structures in Java41 3.1A Simple Java Program42 3.2Comments45 3.3Data Types46 3.3.1Integer

7、 Types47 3.3.2Floating-Point Types48 3.3.3The char Type49 3.3.4The boolean Type51 3.4Variables52 3.4.1Initializing Variables53 3.4.2Constants54 3.5Operators55 3.5.1Increment and Decrement Operators56 3.5.2Relational and boolean Operators57 3.5.3Bitwi

8、se Operators58 3.5.4Mathematical Functions and Constants59 3.5.5Conversions between Numeric Types60 3.5.6Casts61 3.5.7Parentheses and Operator Hierarchy62 3.5.8Enumerated Types63 3.6Strings64 3.6.1Substrings64 3.6.2Concatenation64 3.6.3Strings Are Immutab

9、le65 3.6.4Testing Strings for Equality67 3.6.5Empty and Null Strings68 3.6.5Code Points and Code Units68 3.6.6The String API69 3.6.7Reading the Online API Documentation72 3.6.8Building Strings74 3.7Input and Output76 3.7.1Reading Input76 3.7.2Formatting O

10、utput79 3.7.3File Input and Output84 3.8Control Flow86 3.8.1Block Scope86 3.8.2Conditional Statements87 3.8.3Loops91 3.8.4Determinate Loops95 3.8.5Multiple SelectionsThe switch Statement99 3.8.6Statements That Break Control Flow102 3.9Big Numbers105 

11、3.10Arrays107 3.10.1The “for each” Loop109 3.10.2Array Initializers and Anonymous Arrays110 3.10.3Array Copying111 3.10.4Command-Line Parameters112 3.10.5Array Sorting113 3.10.6Multidimensional Arrays116 3.10.7Ragged Arrays120 Chapter 4: Objects and Classes125

12、 4.1Introduction to Object-Oriented Programming126 4.1.1Classes127 4.1.2Objects128 4.1.3Identifying Classes129 4.1.4Relationships between Classes129 4.2Using Predefined Classes132 4.2.1Objects and Object Variables132 4.2.2The Gregorian Calendar Class of the Ja

13、va Library136 4.2.3Mutator and Accessor Methods138 4.3Defining Your Own Classes145 4.3.1An Employee Class145 4.3.2Use of Multiple Source Files148 4.3.3Dissecting the Employee Class149 4.3.4First Steps with Constructors150 4.3.5Implicit and Explicit Parameters152

14、60;4.3.6Benefits of Encapsulation153 4.3.7Class-Based Access Privileges156 4.3.8Private Methods156 4.3.9Final Instance Fields157 4.4Static Fields and Methods157 4.4.1Static Fields157 4.4.2Static Constants158 4.4.3Static Methods159 4.4.4Factory Methods161 

15、4.4.5The main Method161 4.5Method Parameters164 4.6Object Construction171 4.6.1Overloading171 4.6.2Default Field Initialization172 4.6.3The Constructor with No Arguments173 4.6.4Explicit Field Initialization174 4.6.5Parameter Names175 4.6.6Calling Another Cons

16、tructor176 4.6.7Initialization Blocks176 4.6.8Object Destruction and the finalize Method181 4.7Packages182 4.7.1Class Importation182 4.7.2Static Imports184 4.7.3Addition of a Class into a Package185 4.7.4Package Scope188 4.8The Class Path190 4.8.1Setting

17、the Class Path192 4.9Documentation Comments193 4.9.1Comment Insertion193 4.9.2Class Comments194 4.9.3Method Comments195 4.9.4Field Comments196 4.9.5General Comments196 4.9.6Package and Overview Comments197 4.9.7Comment Extraction198 4.10Class Design Hints

18、199 Chapter 5: Inheritance203 5.1Classes, Superclasses, and Subclasses204 5.1.1Inheritance Hierarchies212 5.1.2Polymorphism213 5.1.3Dynamic Binding214 5.1.4Preventing Inheritance: Final Classes and Methods217 5.1.5Casting218 5.1.6Abstract Classes221 5.1.7

19、Protected Access227 5.2Object: The Cosmic Superclass228 5.2.1The equals Method228 5.2.2Equality Testing and Inheritance230 5.2.3The hashCode Method234 5.2.4The toString Method236 5.3Generic Array Lists243 5.3.1Accessing Array List Elements246 5.3.2Compatibilit

20、y between Typed and Raw Array Lists249 5.4Object Wrappers and Autoboxing251 5.5Methods with a Variable Number of Parameters254 5.6Enumeration Classes256 5.7Reflection258 5.7.1The Class Class259 5.7.2A Primer on Catching Exceptions261 5.7.3Using Reflection to Analyz

21、e the Capabilities of Classes263 5.7.4Using Reflection to Analyze Objects at Runtime269 5.7.5Using Reflection to Write Generic Array Code274 5.7.6Invoking Arbitrary Methods278 5.8Design Hints for Inheritance282 Chapter 6: Interfaces and Inner Classes285 6.1Interfaces286

22、 6.1.1Properties of Interfaces292 6.1.2Interfaces and Abstract Classes294 6.2Object Cloning295 6.3Interfaces and Callbacks302 6.4Inner Classes305 6.4.1Use of an Inner Class to Access Object State307 6.4.2Special Syntax Rules for Inner Classes311 6.4.3Are Inner

23、 Classes Useful? Actually Necessary? Secure?312 6.4.4Local Inner Classes315 6.4.5Accessing final Variables from Outer Methods315 6.4.6Anonymous Inner Classes318 6.4.7Static Inner Classes322 6.5Proxies326 6.5.1Properties of Proxy Classes331 Chapter 7: Graphics Progr

24、amming333 7.1Introducing Swing334 7.2Creating a Frame339 7.3Positioning a Frame342 7.3.1Frame Properties345 7.3.2Determining a Good Frame Size345 7.4Displaying Information in a Component350 7.5Working with 2D Shapes356 7.6Using Color365 7.7Using Special F

25、onts for Text369 7.8Displaying Images378 Chapter 8: Event Handling383 8.1Basics of Event Handling383 8.1.1Example: Handling a Button Click386 8.1.2Becoming Comfortable with Inner Classes391 8.1.3Creating Listeners Containing a Single Method Call394 8.1.4Example: Ch

26、anging the Look-and-Feel395 8.1.5Adapter Classes399 8.2Actions403 8.3Mouse Events411 8.4The AWT Event Hierarchy419 8.4.1Semantic and Low-Level Events421 Chapter 9: User Interface Components with Swing425 9.1Swing and the Model-View-Controller Design Pattern426 

27、;9.1.1Design Patterns426 9.1.2The Model-View-Controller Pattern428 9.1.3A Model-View-Controller Analysis of Swing Buttons432 9.2Introduction to Layout Management433 9.2.1Border Layout437 9.2.2Grid Layout439 9.3Text Input443 9.3.1Text Fields444 9.3.2Labels and

28、Labeling Components446 9.3.3Password Fields447 9.3.4Text Areas448 9.3.5Scroll Panes449 9.4Choice Components452 9.4.1Checkboxes452 9.4.2Radio Buttons454 9.4.3Borders458 9.4.4Combo Boxes462 9.4.5Sliders466 9.5Menus473 9.5.1Menu Building473 9.

29、5.2Icons in Menu Items476 9.5.3Checkbox and Radio Button Menu Items477 9.5.4Pop-Up Menus479 9.5.5Keyboard Mnemonics and Accelerators480 9.5.6Enabling and Disabling Menu Items483 9.5.7Toolbars488 9.5.8Tooltips490 9.6Sophisticated Layout Management492 9.6.1The G

30、rid Bag Layout494 9.6.1.1The gridx, gridy, gridwidth, and gridheight Parameters496 9.6.1.2Weight Fields496 9.6.1.3The fill and anchor Parameters497 9.6.1.4Padding497 9.6.1.5Alternative Method to Specify the gridx, gridy, idwidth,and gridheight Parameters497 9.6.1.6A Hel

31、per Class to Tame the Grid Bag Constraints499 9.6.2Group Layout505 9.6.3Using No Layout Manager516 9.6.4Custom Layout Managers516 9.6.5Traversal Order521 9.7Dialog Boxes522 9.7.1Option Dialogs523 9.7.2Creating Dialogs533 9.7.3Data Exchange538 9.7.4File Di

32、alogs545 9.7.5Color Choosers557 Chapter 10: Deploying Applications and Applets565 10.1JAR Files566 10.1.1The Manifest567 10.1.2Executable JAR Files568 10.1.3Resources569 10.1.4Sealing573 10.2Java Web Start574 10.2.1The Sandbox578 10.2.2Signed Code579

33、 10.2.3The JNLP API582 10.3Applets591 10.3.1A Simple Applet591 10.3.1.1Converting Applications to Applets595 10.3.2The applet HTML Tag and Its Attributes596 10.3.3The object Tag599 10.3.4Use of Parameters to Pass Information to Applets600 10.3.5Accessing Image

34、 and Audio Files606 10.3.6The Applet Context607 10.3.6.1Inter-Applet Communication608 10.3.6.2Displaying Items in the Browser609 10.4Storage of Application Preferences610 10.4.1Property Maps611 10.4.2The Preferences API616 Chapter 11: Exceptions, Assertions, Loggin

35、g, and Debugging625 11.1Dealing with Errors626 11.1.1The Classification of Exceptions628 11.1.2Declaring Checked Exceptions630 11.1.3How to Throw an Exception632 11.1.4Creating Exception Classes634 11.2Catching Exceptions635 11.2.1Catching Multiple Exceptions637

36、60;11.2.2Rethrowing and Chaining Exceptions639 11.2.3The finally Clause640 11.2.4The Try-with-Resources Statement644 11.2.5Analyzing Stack Trace Elements646 11.3Tips for Using Exceptions649 11.4Using Assertions653 11.4.1Assertion Enabling and Disabling654 11.4.2Usi

37、ng Assertions for Parameter Checking655 11.4.3Using Assertions for Documenting Assumptions656 11.5Logging657 11.5.1Basic Logging658 11.5.2Advanced Logging658 11.5.3Changing the Log Manager Configuration661 11.5.4Localization662 11.5.5Handlers663 11.5.6Filters6

38、67 11.5.7Formatters667 11.5.8A Logging Recipe668 11.6Debugging Tips677 11.7Tips for Troubleshooting GUI Programs682 11.7.1Letting the AWT Robot Do the Work686 11.8Using a Debugger690 Chapter 12: Generic Programming697 12.1Why Generic Programming?698 12.1.

39、1Who Wants to Be a Generic Programmer?699 12.2Defining a Simple Generic Class700 12.3Generic Methods702 12.4Bounds for Type Variables704 12.5Generic Code and the Virtual Machine706 12.5.1Translating Generic Expressions708 12.5.2Translating Generic Methods708 12.5.3

40、Calling Legacy Code711 12.6Restrictions and Limitations712 12.6.1Type Parameters Cannot Be Instantiated with Primitive Types712 12.6.2Runtime Type Inquiry Only Works with Raw Types712 12.6.3You Cannot Create Arrays of Parameterized Types713 12.6.4Varargs Warnings713 12.

41、6.5You Cannot Instantiate Type Variables715 12.6.6Type Variables Are Not Valid in Static Contexts of Generic Classes717 12.6.7You Cannot Throw or Catch Instances of a Generic Class717 12.6.7.1You Can Defeat Checked Exception Checking718 12.6.8Beware of Clashes after Erasure720

42、60;12.7Inheritance Rules for Generic Types721 12.8Wildcard Types723 12.8.1Supertype Bounds for Wildcards725 12.8.2Unbounded Wildcards728 12.8.3Wildcard Capture728 12.9Reflection and Generics731 12.9.1Using ClassT Parameters for Type Matching732 12.9.2Generic Type I

43、nformation in the Virtual Machine733 Chapter 13: Collections741 13.1Collection Interfaces741 13.1.1Separating Collection Interfaces and Implementation742 13.1.2Collection and Iterator Interfaces in the Java Library745 13.1.2.1Iterators745 13.1.2.2Removing Elements748

44、60;13.1.2.3Generic Utility Methods748 13.2Concrete Collections751 13.2.1Linked Lists752 13.2.2Array Lists762 13.2.3Hash Sets763 13.2.4Tree Sets767 13.2.5Object Comparison768 13.2.6Queues and Deques774 13.2.7Priority Queues776 13.2.8Maps777 13.2.9Spec

45、ialized Set and Map Classes782 13.2.9.1Weak Hash Maps782 13.2.9.2Linked Hash Sets and Maps783 13.2.9.3Enumeration Sets and Maps785 13.2.9.4Identity Hash Maps785 13.3The Collections Framework787 13.3.1Views and Wrappers792 13.3.1.1Lightweight Collection Wrappers793&

46、#160;13.3.1.2Subranges794 13.3.1.3Unmodifiable Views794 13.3.1.4Synchronized Views796 13.3.1.5Checked Views796 13.3.1.6A Note on Optional Operations797 13.3.2Bulk Operations799 13.3.3Converting between Collections and Arrays800 13.4Algorithms801 13.4.1Sorting

47、and Shuffling802 13.4.2Binary Search805 13.4.3Simple Algorithms806 13.4.4Writing Your Own Algorithms808 13.5Legacy Collections810 13.5.1The Hashtable Class810 13.5.2Enumerations810 13.5.3Property Maps811 13.5.4Stacks812 13.5.5Bit Sets813 13.5.5.1The “Sieve of Eratosthenes” Benchmark814 Chapter 14: Multithreading819 14.1What Are Threads?820 14.1.1Using Threads to Give Other Tasks a Chance827 14.2Interrupting Threads833 14.3Thread States836

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论