出版时间:2013-7-1 出版社:人民邮电出版社 作者:[美]Cay S. Horstmann,Gary Cornell
Tag标签:无
内容概要
《Java核心技术 卷I:基础知识(第9版·英文版)(上、下册)》是经典的《Java核心技术 卷I:基础知识》的最新版。这一版针对Java SE 7平台进行了全面更新,以反映Java SE 7的特性。
书中囊括了Java的全部基础知识,提供了大量完整且具有实际意义的应用示例,详细介绍了Java语言基础、面向对象编程、反射与代理、接口与内部类、事件监听器模型、使用Swing GUI工具进行图形用户界面程序设计、打包应用程序、异常处理、登录与调试、泛型编程、集合框架、多线程等内容。
《Java核心技术 卷I:基础知识(第9版·英文版)(上、下册)》适合想将Java应用于实际项目的软件开发人员、高等院校教师和学生参考阅读。
作者简介
Cay S. Horstmann 是Scala for the Impatient的作者,还与人合著了Core JavaServer Faces。他是圣何塞州立大学计算机科学专业的教授,还是一名Java Champion,并经常在很多开发者大会上演讲。Gary Cornell 在编程方面拥有20多年的写作和教育经验。他是Apress的创始人之一,编写了很多与开发相关的畅销书,是Jolt大奖的获奖者之一,还荣获过Visual Basic Magazine的读者选择奖。
书籍目录
ContentsPreface vAcknowledgments ixChapter 1: An Introduction to Java 11.1 Java As a Programming Platform 11.2 The Java “White Paper” Buzzwords 21.2.1 Simple 31.2.2 Object-Oriented 41.2.3 Network-Savvy 41.2.4 Robust 51.2.5 Secure 51.2.6 Architecture-Neutral 61.2.7 Portable 71.2.8 Interpreted 71.2.9 High-Performance 81.2.10 Multithreaded 81.2.11 Dynamic 81.3 Java Applets and the Internet 91.4 A Short History of Java 101.5 Common Misconceptions about Java 13Chapter 2: The Java Programming Environment 172.1 Installing the Java Development Kit 182.1.1 Downloading the JDK 182.1.2 Setting the Executable Path 202.1.3 Installing the Library Source and Documentation 222.1.4 Installing the Core Java Program Examples 232.1.5 Navigating the Java Directories 242.2 Choosing a Development Environment 242.3 Using the Command-Line Tools 252.3.1 Troubleshooting Hints 272.4 Using an Integrated Development Environment 282.4.1 Locating Compilation Errors 322.5 Running a Graphical Application 332.6 Building and Running Applets 36Chapter 3: Fundamental Programming Structures in Java 413.1 A Simple Java Program 423.2 Comments 453.3 Data Types 463.3.1 Integer Types 473.3.2 Floating-Point Types 483.3.3 The char Type 493.3.4 The boolean Type 513.4 Variables 523.4.1 Initializing Variables 533.4.2 Constants 543.5 Operators 553.5.1 Increment and Decrement Operators 563.5.2 Relational and boolean Operators 573.5.3 Bitwise Operators 583.5.4 Mathematical Functions and Constants 593.5.5 Conversions between Numeric Types 603.5.6 Casts 613.5.7 Parentheses and Operator Hierarchy 623.5.8 Enumerated Types 633.6 Strings 643.6.1 Substrings 643.6.2 Concatenation 643.6.3 Strings Are Immutable 653.6.4 Testing Strings for Equality 673.6.5 Empty and Null Strings 683.6.5 Code Points and Code Units 683.6.6 The String API 693.6.7 Reading the Online API Documentation 723.6.8 Building Strings 743.7 Input and Output 763.7.1 Reading Input 763.7.2 Formatting Output 793.7.3 File Input and Output 843.8 Control Flow 863.8.1 Block Scope 863.8.2 Conditional Statements 873.8.3 Loops 913.8.4 Determinate Loops 953.8.5 Multiple Selections—The switch Statement 993.8.6 Statements That Break Control Flow 1023.9 Big Numbers 1053.10 Arrays 1073.10.1 The “for each” Loop 1093.10.2 Array Initializers and Anonymous Arrays 1103.10.3 Array Copying 1113.10.4 Command-Line Parameters 1123.10.5 Array Sorting 1133.10.6 Multidimensional Arrays 1163.10.7 Ragged Arrays 120Chapter 4: Objects and Classes 1254.1 Introduction to Object-Oriented Programming 1264.1.1 Classes 1274.1.2 Objects 1284.1.3 Identifying Classes 1294.1.4 Relationships between Classes 1294.2 Using Predefined Classes 1324.2.1 Objects and Object Variables 1324.2.2 The GregorianCalendar Class of the Java Library 1364.2.3 Mutator and Accessor Methods 1384.3 Defining Your Own Classes 1454.3.1 An Employee Class 1454.3.2 Use of Multiple Source Files 1484.3.3 Dissecting the Employee Class 1494.3.4 First Steps with Constructors 1504.3.5 Implicit and Explicit Parameters 1524.3.6 Benefits of Encapsulation 1534.3.7 Class-Based Access Privileges 1564.3.8 Private Methods 1564.3.9 Final Instance Fields 1574.4 Static Fields and Methods 1574.4.1 Static Fields 1574.4.2 Static Constants 1584.4.3 Static Methods 1594.4.4 Factory Methods 1614.4.5 The main Method 1614.5 Method Parameters 1644.6 Object Construction 1714.6.1 Overloading 1714.6.2 Default Field Initialization 1724.6.3 The Constructor with No Arguments 1734.6.4 Explicit Field Initialization 1744.6.5 Parameter Names 1754.6.6 Calling Another Constructor 1764.6.7 Initialization Blocks 1764.6.8 Object Destruction and the finalize Method 1814.7 Packages 1824.7.1 Class Importation 1824.7.2 Static Imports 1844.7.3 Addition of a Class into a Package 1854.7.4 Package Scope 1884.8 The Class Path 1904.8.1 Setting the Class Path 1924.9 Documentation Comments 1934.9.1 Comment Insertion 1934.9.2 Class Comments 1944.9.3 Method Comments 1954.9.4 Field Comments 1964.9.5 General Comments 1964.9.6 Package and Overview Comments 1974.9.7 Comment Extraction 1984.10 Class Design Hints 199Chapter 5: Inheritance 2035.1 Classes, Superclasses, and Subclasses 2045.1.1 Inheritance Hierarchies 2125.1.2 Polymorphism 2135.1.3 Dynamic Binding 2145.1.4 Preventing Inheritance: Final Classes and Methods 2175.1.5 Casting 2185.1.6 Abstract Classes 2215.1.7 Protected Access 2275.2 Object: The Cosmic Superclass 2285.2.1 The equals Method 2285.2.2 Equality Testing and Inheritance 2305.2.3 The hashCode Method 2345.2.4 The toString Method 2365.3 Generic Array Lists 2435.3.1 Accessing Array List Elements 2465.3.2 Compatibility between Typed and Raw Array Lists 2495.4 Object Wrappers and Autoboxing 2515.5 Methods with a Variable Number of Parameters 2545.6 Enumeration Classes 2565.7 Reflection 2585.7.1 The Class Class 2595.7.2 A Primer on Catching Exceptions 2615.7.3 Using Reflection to Analyze the Capabilities of Classes 2635.7.4 Using Reflection to Analyze Objects at Runtime 2695.7.5 Using Reflection to Write Generic Array Code 2745.7.6 Invoking Arbitrary Methods 2785.8 Design Hints for Inheritance 282Chapter 6: Interfaces and Inner Classes 2856.1 Interfaces 2866.1.1 Properties of Interfaces 2926.1.2 Interfaces and Abstract Classes 2946.2 Object Cloning 2956.3 Interfaces and Callbacks 3026.4 Inner Classes 3056.4.1 Use of an Inner Class to Access Object State 3076.4.2 Special Syntax Rules for Inner Classes 3116.4.3 Are Inner Classes Useful? Actually Necessary? Secure? 3126.4.4 Local Inner Classes 3156.4.5 Accessing final Variables from Outer Methods 3156.4.6 Anonymous Inner Classes 3186.4.7 Static Inner Classes 3226.5 Proxies 3266.5.1 Properties of Proxy Classes 331Chapter 7: Graphics Programming 3337.1 Introducing Swing 3347.2 Creating a Frame 3397.3 Positioning a Frame 3427.3.1 Frame Properties 3457.3.2 Determining a Good Frame Size 3457.4 Displaying Information in a Component 3507.5 Working with 2D Shapes 3567.6 Using Color 3657.7 Using Special Fonts for Text 3697.8 Displaying Images 378Chapter 8: Event Handling 3838.1 Basics of Event Handling 3838.1.1 Example: Handling a Button Click 3868.1.2 Becoming Comfortable with Inner Classes 3918.1.3 Creating Listeners Containing a Single Method Call 3948.1.4 Example: Changing the Look-and-Feel 3958.1.5 Adapter Classes 3998.2 Actions 4038.3 Mouse Events 4118.4 The AWT Event Hierarchy 4198.4.1 Semantic and Low-Level Events 421Chapter 9: User Interface Components with Swing 4259.1 Swing and the Model-View-Controller Design Pattern 4269.1.1 Design Patterns 4269.1.2 The Model-View-Controller Pattern 4289.1.3 A Model-View-Controller Analysis of Swing Buttons 4329.2 Introduction to Layout Management 4339.2.1 Border Layout 4379.2.2 Grid Layout 4399.3 Text Input 4439.3.1 Text Fields 4449.3.2 Labels and Labeling Components 4469.3.3 Password Fields 4479.3.4 Text Areas 4489.3.5 Scroll Panes 4499.4 Choice Components 4529.4.1 Checkboxes 4529.4.2 Radio Buttons 4549.4.3 Borders 4589.4.4 Combo Boxes 4629.4.5 Sliders 4669.5 Menus 4739.5.1 Menu Building 4739.5.2 Icons in Menu Items 4769.5.3 Checkbox and Radio Button Menu Items 4779.5.4 Pop-Up Menus 4799.5.5 Keyboard Mnemonics and Accelerators 4809.5.6 Enabling and Disabling Menu Items 4839.5.7 Toolbars 4889.5.8 Tooltips 4909.6 Sophisticated Layout Management 4929.6.1 The Grid Bag Layout 4949.6.1.1 The gridx, gridy, gridwidth, and gridheight Parameters 4969.6.1.2 Weight Fields 4969.6.1.3 The fill and anchor Parameters 4979.6.1.4 Padding 4979.6.1.5 Alternative Method to Specify the gridx, gridy, idwidth,and gridheight Parameters 4979.6.1.6 A Helper Class to Tame the Grid Bag Constraints 4999.6.2 Group Layout 5059.6.3 Using No Layout Manager 5169.6.4 Custom Layout Managers 5169.6.5 Traversal Order 5219.7 Dialog Boxes 5229.7.1 Option Dialogs 5239.7.2 Creating Dialogs 5339.7.3 Data Exchange 5389.7.4 File Dialogs 5459.7.5 Color Choosers 557Chapter 10: Deploying Applications and Applets 56510.1 JAR Files 56610.1.1 The Manifest 56710.1.2 Executable JAR Files 56810.1.3 Resources 56910.1.4 Sealing 57310.2 Java Web Start 57410.2.1 The Sandbox 57810.2.2 Signed Code 57910.2.3 The JNLP API 58210.3 Applets 59110.3.1 A Simple Applet 59110.3.1.1 Converting Applications to Applets 59510.3.2 The applet HTML Tag and Its Attributes 59610.3.3 The object Tag 59910.3.4 Use of Parameters to Pass Information to Applets 60010.3.5 Accessing Image and Audio Files 60610.3.6 The Applet Context 60710.3.6.1 Inter-Applet Communication 60810.3.6.2 Displaying Items in the Browser 60910.4 Storage of Application Preferences 61010.4.1 Property Maps 61110.4.2 The Preferences API 616Chapter 11: Exceptions, Assertions, Logging, and Debugging 62511.1 Dealing with Errors 62611.1.1 The Classification of Exceptions 62811.1.2 Declaring Checked Exceptions 63011.1.3 How to Throw an Exception 63211.1.4 Creating Exception Classes 63411.2 Catching Exceptions 63511.2.1 Catching Multiple Exceptions 63711.2.2 Rethrowing and Chaining Exceptions 63911.2.3 The finally Clause 64011.2.4 The Try-with-Resources Statement 64411.2.5 Analyzing Stack Trace Elements 64611.3 Tips for Using Exceptions 64911.4 Using Assertions 65311.4.1 Assertion Enabling and Disabling 65411.4.2 Using Assertions for Parameter Checking 65511.4.3 Using Assertions for Documenting Assumptions 65611.5 Logging 65711.5.1 Basic Logging 65811.5.2 Advanced Logging 65811.5.3 Changing the Log Manager Configuration 66111.5.4 Localization 66211.5.5 Handlers 66311.5.6 Filters 66711.5.7 Formatters 66711.5.8 A Logging Recipe 66811.6 Debugging Tips 67711.7 Tips for Troubleshooting GUI Programs 68211.7.1 Letting the AWT Robot Do the Work 68611.8 Using a Debugger 690Chapter 12: Generic Programming 69712.1 Why Generic Programming? 69812.1.1 Who Wants to Be a Generic Programmer? 69912.2 Defining a Simple Generic Class 70012.3 Generic Methods 70212.4 Bounds for Type Variables 70412.5 Generic Code and the Virtual Machine 70612.5.1 Translating Generic Expressions 70812.5.2 Translating Generic Methods 70812.5.3 Calling Legacy Code 71112.6 Restrictions and Limitations 71212.6.1 Type Parameters Cannot Be Instantiated with Primitive Types 71212.6.2 Runtime Type Inquiry Only Works with Raw Types 71212.6.3 You Cannot Create Arrays of Parameterized Types 71312.6.4 Varargs Warnings 71312.6.5 You Cannot Instantiate Type Variables 71512.6.6 Type Variables Are Not Valid in Static Contexts of Generic Classes 71712.6.7 You Cannot Throw or Catch Instances of a Generic Class 71712.6.7.1 You Can Defeat Checked Exception Checking 71812.6.8 Beware of Clashes after Erasure 72012.7 Inheritance Rules for Generic Types 72112.8 Wildcard Types 72312.8.1 Supertype Bounds for Wildcards 72512.8.2 Unbounded Wildcards 72812.8.3 Wildcard Capture 72812.9 Reflection and Generics 73112.9.1 Using Class Parameters for Type Matching 73212.9.2 Generic Type Information in the Virtual Machine 733Chapter 13: Collections 74113.1 Collection Interfaces 74113.1.1 Separating Collection Interfaces and Implementation 74213.1.2 Collection and Iterator Interfaces in the Java Library 74513.1.2.1 Iterators 74513.1.2.2 Removing Elements 74813.1.2.3 Generic Utility Methods 74813.2 Concrete Collections 75113.2.1 Linked Lists 75213.2.2 Array Lists 76213.2.3 Hash Sets 76313.2.4 Tree Sets 76713.2.5 Object Comparison 76813.2.6 Queues and Deques 77413.2.7 Priority Queues 77613.2.8 Maps 77713.2.9 Specialized Set and Map Classes 78213.2.9.1 Weak Hash Maps 78213.2.9.2 Linked Hash Sets and Maps 78313.2.9.3 Enumeration Sets and Maps 78513.2.9.4 Identity Hash Maps 78513.3 The Collections Framework 78713.3.1 Views and Wrappers 79213.3.1.1 Lightweight Collection Wrappers 79313.3.1.2 Subranges 79413.3.1.3 Unmodifiable Views 79413.3.1.4 Synchronized Views 79613.3.1.5 Checked Views 79613.3.1.6 A Note on Optional Operations 79713.3.2 Bulk Operations 79913.3.3 Converting between Collections and Arrays 80013.4 Algorithms 80113.4.1 Sorting and Shuffling 80213.4.2 Binary Search 80513.4.3 Simple Algorithms 80613.4.4 Writing Your Own Algorithms 80813.5 Legacy Collections 81013.5.1 The Hashtable Class 81013.5.2 Enumerations 81013.5.3 Property Maps 81113.5.4 Stacks 81213.5.5 Bit Sets 81313.5.5.1 The “Sieve of Eratosthenes” Benchmark 814Chapter 14: Multithreading 81914.1 What Are Threads? 82014.1.1 Using Threads to Give Other Tasks a Chance 82714.2 Interrupting Threads 83314.3 Thread States 83614.3.1 New Threads 83614.3.2 Runnable Threads 83614.3.3 Blocked and Waiting Threads 83714.3.4 Terminated Threads 83914.4 Thread Properties 83914.4.1 Thread Priorities 84014.4.2 Daemon Threads 84114.4.3 Handlers for Uncaught Exceptions 84114.5 Synchronization 84314.5.1 An Example of a Race Condition 84314.5.2 The Race Condition Explained 84814.5.3 Lock Objects 85014.5.4 Condition Objects 85414.5.5 The synchronized Keyword 85914.5.6 Synchronized Blocks 86414.5.7 The Monitor Concept 86514.5.8 Volatile Fields 86614.5.9 Final Variables 86714.5.10 Atomics 86814.5.11 Deadlocks 86814.5.12 Thread-Local Variables 87114.5.13 Lock Testing and Timeouts 87314.5.14 Read/Write Locks 87414.5.15 Why the stop and suspend Methods Are Deprecated 87514.6 Blocking Queues 87714.7 Thread-Safe Collections 88614.7.1 Efficient Maps, Sets, and Queues 88614.7.2 Copy on Write Arrays 88814.7.3 Older Thread-Safe Collections 88814.8 Callables and Futures 89014.9 Executors 89514.9.1 Thread Pools 89614.9.2 Scheduled Execution 90014.9.3 Controlling Groups of Tasks 90114.9.4 The Fork-Join Framework 90214.10 Synchronizers 90514.10.1 Semaphores 90614.10.2 Countdown Latches 90714.10.3 Barriers 90714.10.4 Exchangers 90814.10.5 Synchronous Queues 90814.11 Threads and Swing 90914.11.1 Running Time-Consuming Tasks 91014.11.2 Using the Swing Worker 91514.11.3 The Single-Thread Rule 923Appendix: Java Keywords 925Index 929
编辑推荐
Java经典图书最新版,前一版曾获得第13届Jolt生产效率大奖。Java平台的权威指南,新版做了全面更新,体现了Java SE 7的变化,将对Java SE 7新特性的完整描述融入对Java基本概念的精辟阐述中。Java核心技术 卷I:基础知识(第9版·英文版)(上、下册)专为做实际项目的程序员编写,是一本真实可信、不偏不倚且简单直接的Java教程,书中使用了全面测试过的代码示例来阐述关键的Java语言与库的特性,体现了最佳的编程实践。 Java核心技术 卷I:基础知识(第9版·英文版)(上、下册)两位作者均是业内权威人物,有丰富的写作和实战经验。
图书封面
图书标签Tags
无
评论、评分、阅读与下载